Environment:
- OS: Ubuntu 16.04
- Hardware clock is set to UTC
Add following cron entries for 'root' usr:
0 2 * * Sun-Thu /usr/sbin/rtcwake -m mem --date 14:00 >> /opt/automation/logs/rtcwake.log 2>&1
0 3 * * Fri-Sat /usr/sbin/rtcwake -m mem --date 08:00 >> /opt/automation/logs/rtcwake.log 2>&1
This is using "rtcwake" command.
-m : shutdown/suspend/sleep method. "mem" is suspend to memory.
--date: wake up date in 24-hr format
It's set to suspend at 2am/3am -- plenty of time to do some batch job/back up that starts at night, then shutdown (or suspend).
References
- hwclock - set hardware clock setting
- timedatectl - find if the computer is set to use UTC for hw clock
- rtcwake
No comments:
Post a Comment