RSS Feed


CentOS VPS Automatic Daily Server Restart GoDaddy

CentOS VPS Automatic Daily Server Restart GoDaddy
Posted on Nov 26, 2013 by Stephen Owens
Tutorial and Code category
   [ Return ]

Automatic daily server restart on a CentOS GoDaddy VPS. This will work for any linux os, and not limited to GoDaddy.

I recevied a question today via email, asking how to automatically reboot a linux VPS web server.

How to setup the Automatic Daily Reboot

This is done via command line. So using an SSH client (I like Putty on Windows, Linux SSH client on Ubuntu, and Secure Shell on my Chromebook) access your server as the root user.

Swtiching to Root in SSH

You will need to setup the CRON job as root. If you need to switch to root after you access the shell you can do it with the following command.

su - root

Setup a CRON job for Auto Reboot

Then open the file crontab in an editor; the vi editor is fine for this.

vi /etc/crontab

Add the following line to the file; at the end will be fine.

  1. 0 4 * * * /sbin/shutdown -r now

view RAW source:

This will cause the shutdown command to run. The -r flag will cause the server to reboot after shutdown. This command requires a time parameter so we'll use now to make it happen when the CRON job runs.

Setting Up Cron Jobs via cPanel

If you have cPanel installed then you can use it to setup your automatic server reboot. You would create a new CRON job via cPanel, and under the command type

  1. 0 4 * * * /sbin/shutdown -r now

view RAW source:

More info available in the cPanel Cron Job documentation.

More about CRON jobs

Get to know CRON your time based job scheduler.

Like what you read? Get updates for free!
comments powered by Disqus