Monthly and Weekly Cron Jobs
In the house network monthly and weekly cron jobs are run on Saturday with the monthly tasks run on the first Saturday of the month.
In many environments servers are run 24/7 and skipping cron jobs is rare. That is not the case in the house network. To conserve energy usage all systems in the house network are powered down nightly using scripts and a cron job. The office desktop is no exception and is a pseudo server providing several common network services such as DNS, NTP, and file sharing through NFS and CIFS. Many important administrative tasks are run on the office desktop using cron and the at scheduler. Even if network services were moved to a dedicated server, that system would be powered down nightly too. Wake-on-LAN (WoL) and real-time clocks (RTC) are used to ensure systems are available as needed.
There is no guarantee the office desktop will be powered on when monthly and weekly administrative tasks should be launched. Skipping those tasks would not be the end of the world for the house network, but there is no notable reason to skip them either.
A shell script ensures the office desktop will be powered on to run the monthly and weekly cron jobs. A nominal requirement is ensuring the system powers on before either the monthly or weekly cron jobs launch. The monthly tasks are few and run an hour before the weekly tasks. The script parses the monthly and weekly cron job times. When the upcoming Saturday is the first Saturday of the month, then the monthly cron job time is used as a wakeup time. To avoid inadvertent boot delays such as file system checks, the script adds a 10 minute buffer to the desired wakeup time.
The wakeup time is then scheduled with the at scheduler. A different script parses all at scheduler jobs and sets a wakeup time with the RTC.
The script is launched from rc.local
and rc.local_shutdown
as well as in the hourly cron jobs. Launching the script in rc.local_shutdown
ensures the system awakens the following Saturday in case of extended power down periods such as vacations.
Posted: Usability Tagged: General
Category:Next: No Kernel Modules Found
Previous: Syntax Highlighting