1
0
Fork 0
mirror of https://github.com/yavook/kiwi-cron.git synced 2024-11-21 15:03:01 +00:00
This commit is contained in:
Jörn-Michael Miehe 2022-03-03 00:26:50 +01:00
parent e415d0b7e0
commit ff334bc603

View file

@ -5,29 +5,26 @@ cs_units="${2}"
cs_command="${3}" cs_command="${3}"
if [ "${cs_every}" = "1" ]; then if [ "${cs_every}" = "1" ]; then
cs_every="" cs_every="*"
else else
cs_every="/${cs_every}" cs_every="*/${cs_every}"
fi fi
# generate valid random schedule values
# generally, "nighttime" and "weekend" will be preferred.
case "${cs_units}" in case "${cs_units}" in
minute) minute)
echo "*${cs_every} * * * * ${cs_command}" echo "${cs_every} * * * * ${cs_command}"
;; ;;
hour) hour)
echo "R *${cs_every} * * * ${cs_command}" echo "R ${cs_every} * * * ${cs_command}"
;; ;;
day) day)
echo "R R *${cs_every} * * ${cs_command}" echo "R R ${cs_every} * * ${cs_command}"
;; ;;
week) week)
echo "R R * * R ${cs_command}" echo "R R * * R ${cs_command}"
;; ;;
month) month)
echo "R R R *${cs_every} * ${cs_command}" echo "R R R ${cs_every} * ${cs_command}"
;; ;;
year) year)
echo "R R R R * ${cs_command}" echo "R R R R * ${cs_command}"