add crontab-suggest

This commit is contained in:
neingeist 2015-06-29 21:30:37 +02:00
parent 5913fc67b4
commit 9273822038

17
crontab-suggest Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash
# suggest a random time for a cronjob
set -u
set -e
hour=$((($RANDOM*24)/32768))
minute=$((($RANDOM*60)/32768))
dow="*"
if [ $# -gt 0 ]; then
if [ "$1" == "-w" ]; then
dow=$((($RANDOM*7)/32768))
fi
fi
printf "%02i %02i * * %s\n" "$minute" "$hour" "$dow"