@@ -1843,7 +1843,7 @@ timer() {
18431843 if [ "${expression_step}" != "${expression}" ]; then
18441844 for step in ${validate_temp}; do
18451845 if [ $(( ( step - expression_start ) % expression_step )) -eq 0 ]; then
1846- validate_all="$validate_all ${step}"
1846+ validate_all="${ validate_all} ${step}"
18471847 fi
18481848 done
18491849 else
@@ -1853,13 +1853,14 @@ timer() {
18531853
18541854 validate_all=$(echo "${validate_all}" | tr ' ' '\n' | sort -n -u | tr '\n' ' ')
18551855 for entry in $validate_all; do
1856- if [ " ${entry}" -ge " ${3}" ]; then
1856+ if [ ${entry} -ge ${3} ]; then
18571857 echo "${entry}"
18581858 return 0
18591859 fi
18601860 done
18611861
1862- echo "${validate_all%% *}"
1862+ echo "${validate_all// /}"
1863+ #echo "${validate_all%% *}"
18631864 }
18641865
18651866 local cron_compare="${3}"
@@ -1878,7 +1879,10 @@ timer() {
18781879 local cron_minute="$(echo -n "${2}" | awk '{print $1}')"
18791880 local cron_hour="$(echo -n "${2}" | awk '{print $2}')"
18801881 local cron_day_of_month="$(echo -n "${2}" | awk '{print $3}')"
1881- local cron_month="$(echo -n "${2}" | awk '{print $4}')"Generating
1882+ local cron_month="$(echo -n "${2}" | awk '{print $4}')"
1883+ local cron_day_of_week="$(echo -n "${2}" | awk '{print $5}')"
1884+
1885+ local cron_next_minute="$(date --date=@"${cron_compare}" +"%-M")"
18821886 local cron_next_hour="$(date --date=@"${cron_compare}" +"%-H")"
18831887 local cron_next_day_of_month="$(date --date=@"${cron_compare}" +"%-d")"
18841888 local cron_next_month="$(date --date=@"${cron_compare}" +"%-m")"
@@ -1887,8 +1891,10 @@ timer() {
18871891 local cron_next_year="$(date --date=@"${cron_compare}" +"%-Y")"
18881892
18891893 local cron_next=
1894+ local cron_parsed=1
18901895
1891- while [ "$cron_parsed" != "0" ]; do
1896+ while [ "${cron_parsed}" != "0" ]; do
1897+ print_debug "[timer] [cron] Parse Minute"
18921898 cron_next=$(parse_expression "${cron_minute}" 59 "${cron_next_minute}")
18931899 if [ "${cron_next}" != "${cron_next_minute}" ]; then
18941900 if [ "${cron_next_minute}" -gt "${cron_next}" ]; then
@@ -1898,20 +1904,22 @@ timer() {
18981904 cron_next_minute="${cron_next}"
18991905 fi
19001906
1907+ print_debug "[timer] [cron] Parse Hour"
19011908 cron_next=$(parse_expression "${cron_hour}" 23 "${cron_next_hour}")
19021909 if [ "${cron_next}" != "${cron_next_hour}" ]; then
19031910 if [ "${cron_next_hour}" -gt "${cron_next}" ]; then
19041911 cron_next_day_of_month=$(( cron_next_day_of_month + 1 ))
19051912 fi
1913+
19061914 cron_next_hour="${cron_next}"
1907- #cron_next_minute=0
19081915 fi
19091916
1917+ print_debug "[timer] [cron] Parse Day of Week"
19101918 cron_next=$(parse_expression "${cron_day_of_week}" 6 "${cron_next_day_of_week}")
19111919 if [ "${cron_next}" != "${cron_next_day_of_week}" ]; then
1912- day_of_week_difference=$(( ${ cron_next} - ${ cron_next_day_of_week} ))
1920+ day_of_week_difference=$(( cron_next - cron_next_day_of_week ))
19131921
1914- if [ "${day_of_week_difference}" -lt "0" ]; then
1922+ if [ "${day_of_week_difference}" -lt 0 ]; then
19151923 day_of_week_difference=$(( day_of_week_difference + 7 ))
19161924 fi
19171925
@@ -1920,6 +1928,7 @@ timer() {
19201928 cron_next_minute=0
19211929 fi
19221930
1931+ print_debug "[timer] [cron] Parse day of month"
19231932 case "${cron_next_month}" in
19241933 1|3|5|7|8|10|12)
19251934 last_day_of_month="31"
@@ -1959,6 +1968,7 @@ timer() {
19591968 cron_next_day_of_month=$cron_next
19601969 fi
19611970
1971+ print_debug "[timer] [cron] Parse Next Month"
19621972 cron_next=$(parse_expression "${cron_month}" 12 "${cron_next_month}")
19631973 if [ "${cron_next}" != "${cron_next_month}" ]; then
19641974 if [ "${cron_next}" -gt "12" ]; then
0 commit comments