Skip to main content

Scheduling an automatic graceful reboot

Comments

14 comments

  • kernow
    Rebooting can be a stressful time for many system admins, you keep your fingers crossed its going to come back up without error so leaving this to a one off cron job while your not present is enough to keep you up all night ;) You might want to look at the KernelCare solution: CloudLinux - Main | New template
    0
  • vacancy
    The healthiest method is to use KernelCare. Without the need to restart the system, your kernel will stay up to date with zero interruption. If you do not want to use it, you can prepare a cron to restart the server every month. Kernel updates are usually issued every 1-2 months. (changeable) The update will not be active momentarily. The only negative side is this.
    0
  • webhostuk
    We use Ksplice does kernal upgrade without the need of reboot, I guess thats a good option if your concern is just about kernel upgrade.
    0
  • cPanelMichael
    Hello, I agree with the previous posts. An unattended reboot is generally not a good idea, as you always want to make sure the system successfully boots again. Kernel Care is a useful third-party solution if you'd like to avoid reboots when upgrading a kernel: CloudLinux - Main | New template Thank you.
    0
  • m4f1aboy
    Thanks for the information, it is greatly appreciated. It wouldn't be an unattended reboot; I have software that emails me alerts when the server goes down and when it comes back online, so if it doesn't come back online I can remote in and manually boot it up. It is aimed more towards me scheduling it so I don't forget to reboot late at night when needed. Thanks again, cheers.
    0
  • CrazySerb
    I'm curious if there is a way to do this by now as well somehow...
    0
  • cPRex Jurassic Moderator
    @CrazySerb - cPanel doesn't have any plans to add a scheduled reboot feature into the product. Is that what you're looking for?
    0
  • CrazySerb
    @CrazySerb - cPanel doesn't have any plans to add a scheduled reboot feature into the product. Is that what you're looking for?

    Yes, either via cPanel or some sort of a crontab command that we can issue at specific times of the week or whenever... as we have uptime monitors anyway, so if anything goes sideways during the reboot we'll know immediately.
    0
  • cPRex Jurassic Moderator
    I'm not seeing a feature request for this when I searched just now, so feel free to submit one!
    0
  • vacancy
    You can add a command like this into the /var/spool/cron/root file. 0 5 * * * /sbin/shutdown -r now This command will restart your server at 05:00 am. UPDATE: Command edit.
    0
  • ffeingol
    You can add a command like this into the /var/spool/cron/root file. 0 5 * * * /sbin/shutdown -h now This command will restart your server at 05:00 am.

    You don't want that command. -h is halt (or shutdown). At a minimum you want shutdown -r now in the cron (-r is reboot). The last parameter (now) is the time that you want the reboot. So you can simply do something like: shutdown -r 23:50 and that will schedule a reboot at 23:50. man shutdown will give you all the details.
    0
  • CrazySerb
    You don't want that command. -h is halt (or shutdown). At a minimum you want shutdown -r now in the cron (-r is reboot). The last parameter (now) is the time that you want the reboot. So you can simply do something like: shutdown -r 23:50 and that will schedule a reboot at 23:50. man shutdown will give you all the details.

    That will do! So if I was to add it to cron, it would be to once a day sort of a job? Something like 0 0 * * * /sbin/shutdown -r 06:00 So that at midnight it schedules a reboot at 6am? Would that be the equivalent of this: 0 6 * * * /sbin/shutdown -r now ??
    0
  • ffeingol
    Yes, those appear to do the same thing. No idea, why you would want to reboot daily, however.
    0
  • CrazySerb
    Yes, those appear to do the same thing. No idea, why you would want to reboot daily, however.

    Just a temporary fix for certain server / software package issues until they are resolved on the software level (certain processes ending up being locked up and only a reboot fixing them all properly). That's all.
    0

Please sign in to leave a comment.