add crontab-suggest
This commit is contained in:
parent
5913fc67b4
commit
9273822038
1 changed files with 17 additions and 0 deletions
17
crontab-suggest
Executable file
17
crontab-suggest
Executable 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"
|
Loading…
Add table
Add a link
Reference in a new issue