Shutdown timer for server Debian 12

Discussion in 'Server Operation' started by Martin Svoboda, Feb 21, 2024.

  1. Martin Svoboda

    Martin Svoboda New Member

    Good day, Please help.
    I have Debian 12.5 installed no graphical environment
    How do I set the server shutdown at a given time every day?
    Thank you
    Martin Svoboda
     
  2. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Why do you ever want to shut a server down as it normally needs to be on 24/7, however, if you mean a reboot, when there is a need for it, then it should be fine. Anyway, to achieve any of that, you should learn what is cron job and then, simply create a cron job for what you want.
     
  3. Martin Svoboda

    Martin Svoboda New Member

    Thanks for the help. I'll give it a try

     
  4. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Using cron, as root enter to root crontab the line
    Code:
    05  06 * * *         /sbin/shutdown -h now
    That does shutdwon at 5 minutes past 6 in the morning. Adjust time if needed.
    Another way, if you only want this occasionally and do not want to idly wait near the host until suitable reboot time, is command at. That allows typing the command now but executing it at the given time. On Debian GNU/Linux it is in package at.
     
    wileywalker likes this.

Share This Page