From 5a108be182619da1f7fbda3d61a8401ee79f0bbd Mon Sep 17 00:00:00 2001 From: Maksim Usmanov | Maks Date: Tue, 23 Jan 2018 23:53:27 +0100 Subject: [PATCH] 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 * * * * --- func/main.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/func/main.sh b/func/main.sh index 4d48293db..2d0ca1f10 100644 --- a/func/main.sh +++ b/func/main.sh @@ -753,9 +753,13 @@ is_cron_format_valid() { fi done fi - if [[ "$1" =~ ^[0-9]+$ ]] && [ "$1" -le $limit ]; then - check_format='ok' - fi + crn_values=$(echo $1 |tr "," " " | tr "-" " ") + for crn_vl in $crn_values + do + if [[ "$crn_vl" =~ ^[0-9]+$ ]] && [ "$crn_vl" -le $limit ]; then + check_format='ok' + fi + done if [ "$check_format" != 'ok' ]; then check_result $E_INVALID "invalid $2 format :: $1" fi