Skip to content

Commit 5a108be

Browse files
authored
Fix cron validation
New vesta cron generator not works if you have some format ranges like: 1,2 2 * 5,2,4,1 or 1-10 * * * *
1 parent 8a21735 commit 5a108be

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

func/main.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -753,9 +753,13 @@ is_cron_format_valid() {
753753
fi
754754
done
755755
fi
756-
if [[ "$1" =~ ^[0-9]+$ ]] && [ "$1" -le $limit ]; then
757-
check_format='ok'
758-
fi
756+
crn_values=$(echo $1 |tr "," " " | tr "-" " ")
757+
for crn_vl in $crn_values
758+
do
759+
if [[ "$crn_vl" =~ ^[0-9]+$ ]] && [ "$crn_vl" -le $limit ]; then
760+
check_format='ok'
761+
fi
762+
done
759763
if [ "$check_format" != 'ok' ]; then
760764
check_result $E_INVALID "invalid $2 format :: $1"
761765
fi

0 commit comments

Comments
 (0)