How to schedule shutdown every day?

12,895

The shutdown command has already an embedded scheduler so you don't need a cron job for it to run at the specified time. In Linux as everywhere else, it's better to stick to the KISS principle (Keep It Short and Simple).

shutdown -h 22:00 will work fine, no need to run it in the background. Add the command at the end of /etc/rc.local (or /etc/rc.d/rc.local depending on your system) for execution in the last startup script.

The advantage of not using cron is that in this way the shutdown remains scheduled during the day, and you can cancel it at any time by typing

shutdown -c 
Share:
12,895

Related videos on Youtube

arauzo
Author by

arauzo

Updated on September 18, 2022

Comments

  • arauzo
    arauzo over 1 year

    We have a server that is used for Linux thin clients in a class. The server is started when required and I want to schedule it to power off at 22:00 every day to avoid power wasting.

    I thought of using crontab but, after reading this answer, I am not sure if it is a good idea. Is it better to include shutdown -h 22:00 & in a start up script?