I am trying to delay the daily reboot of multiple Linux machines by a random time, within one hour.
This is to avoid a simultaneous reboot of all the Linux machines at the same time.
I also want to avoid specifying a time in cron. I want it to be completely random between 00:00 and 01:00.
So far I tried the commands below, but no luck. The machines still reboot at midnight.
Code:
@daily /bin/sleep $((RANDOM\%3600)) && /sbin/reboot
@daily /bin/sleep $(/usr/bin/expr $RANDOM \% 3600); /bin/reboot