Don't schedule the shutdown with
anacron. Schedule it as a
cron job instead.
The purpose of
anacron is to make sure that system maintenance tasks are run on a regular basis, even if the machine is powered off for periods at a time (in which case any jobs that should have been run during the downtime will run as soon as possible once the system is back on line and
anacron is executed).
anacron is not the job scheduler you'd want to run a nightly shutdown job with, or anything else that is required to run at specific times.
Instead, add a cronjob for root:
0 1 * * * /sbin/poweroff
(or whatever other command you may use to power off your machine)
Also make sure that
anacron is not used to run the job (check the
There is absolutely no issues with running both
anacron jobs on the same machine. In fact, you should probably be running
cron. Just make sure that jobs handled by
cron are not also handled by
anacron and vice versa.
In my own crontab for root, I have the following entries that executes
anacron on reboots and at midnight:
@reboot /usr/local/sbin/anacron -ds
@daily /usr/local/sbin/anacron -ds