You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
278 B
Plaintext
18 lines
278 B
Plaintext
10 years ago
|
#!/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"
|