Auto restart with cron.. How to do it?



  • I want to reboot the box everynight at 2 am..any idea how i can do this?



  • Install the cron package to make it easier to add cron jobs.

    The command seems to be /sbin/shutdown -p now
    Just add that as your command and root as the user like other jobs already in there.

    I haven't tested this though.



  • Dont do a /sbin/shutdown -p now that just powers down the system.

    do a /sbin/reboot



  • You're right. I copied the line from a page where I found the full path for the shutdown command. I mean to change it to shutdown -r now which as far as I know will do the same as reboot but I may be mistaken.



  • Yes, 'shutdown -r now' will do an immediate reboot.  You can replace 'now' with a number of minutes ('shutdown -r 5' for a reboot in five minutes, say) or an absolute time but you won't need that with a chron job.



  • Why do you need to bounce the box every night?



  • @Topell:

    Why do you need to bounce the box every night?

    Just to try and keep things running smooth…

    Its for a user whos 300 miles away and they have some slowness issues after squid has been runing for a few days and the webcon give a 500 error at random.



  • So you're slapping a horrible bandage on the problem rather than addressing it?



  • @jdwilliams:

    @Topell:

    Why do you need to bounce the box every night?

    Just to try and keep things running smooth…

    Its for a user whos 300 miles away and they have some slowness issues after squid has been runing for a few days and the webcon give a 500 error at random.

    Do you normally work with Windows?


Log in to reply