Skip to content

Commit

Permalink
Several enhancement to generate-cron-entry.sh (#45084)
Browse files Browse the repository at this point in the history
  • Loading branch information
liangxia committed Oct 31, 2023
1 parent 02da629 commit 4cab6db
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ if ! [[ "$TEST_NAME" =~ (p[1-3])?-f[0-9]+ ]] ; then
fi

FN="$(echo $TEST_NAME | sed -E 's/.*-f([0-9]+)(.*)?/\1/')"
NUMBERS="$(echo $TEST_NAME $YAML_FILE | md5sum | tr -d [0a-z])"
NUMBERS="$(echo $TEST_NAME $YAML_FILE | md5sum | tr [a-f] [1-6] | tr -d ' -')"
if [[ $DEBUG = "true" ]] ; then
echo "FN: $FN"
echo "NUMBERS: $NUMBERS"
fi


let MINUTE=${NUMBERS:0:2}%60
let HOUR=${NUMBERS:2:2}%24
let DAY_OF_MONTH=${NUMBERS:4:2}%30+1
let MONTH=${NUMBERS:6:2}%12+1
let DAY_OF_WEEK=${NUMBERS:8:1}%7
let MINUTE=10#${NUMBERS:0:2}%60
let HOUR=10#${NUMBERS:2:2}%24
let DAY_OF_MONTH=10#${NUMBERS:4:2}%30+1
let MONTH=10#${NUMBERS:6:2}%12+1
let DAY_OF_WEEK=10#${NUMBERS:8:1}%7

if [[ $DEBUG = "true" ]] ; then
echo "MINUTE: $MINUTE"
Expand All @@ -69,7 +69,7 @@ case "$FN" in
2|3|4|5|6|7|10|14|28|30)
DAY_OF_MONTH_TMP=$DAY_OF_MONTH
for ((i=1 ; i<31/FN; ++i)) ; do
let TMP=(i*FN+DAY_OF_MONTH)%30+1
let TMP=(i*FN+DAY_OF_MONTH-1)%30+1
DAY_OF_MONTH_TMP+=",$TMP"
done
DAY_OF_MONTH_FINAL=$(echo $DAY_OF_MONTH_TMP | sed 's/,/\n/g' | sort -n | paste -s -d ',' -)
Expand Down

0 comments on commit 4cab6db

Please sign in to comment.