Hostxpeed
Login Get Started →
Server Management

How to Set Up Daily Server Reboot

4 min read
25 views
Jun 12, 2026

Prerequisites

Before setting up daily reboots, make sure you have:

  • SSH access to your VPS
  • Root or sudo privileges

⚠️ Daily reboots are generally NOT recommended for production servers. Only use for temporary, test, or memory-leaking applications.

Step 1: Check Current Uptime

Connect to your VPS:

ssh hxroot@YOUR_SERVER_IP -p 22
uptime

Step 2: Create Reboot Script

sudo nano /usr/local/bin/daily-reboot.sh

Add content:

#!/bin/bash
echo "Server reboot initiated at $(date)" >> /var/log/reboot.log
/sbin/shutdown -r +5 "System will reboot in 5 minutes for scheduled maintenance"

Make executable:

sudo chmod +x /usr/local/bin/daily-reboot.sh

Step 3: Schedule with Cron

sudo crontab -e

Add line for 3:00 AM daily:

0 3 * * * /usr/local/bin/daily-reboot.sh

Step 4: Test the Cron Job (Optional)

Run manually to test:

sudo /usr/local/bin/daily-reboot.sh

You will see the shutdown message. Cancel with:

sudo shutdown -c

Alternative: Direct Cron Reboot (Immediate, No Warning)

0 3 * * * /sbin/reboot

⚠️ Immediate reboot without warning can cause data loss. Always use shutdown with delay or notify users.

Set Up Reboot Notification

Add to script before reboot:

# Send email notification
echo "Server $(hostname) will reboot at $(date)" | mail -s "Server Reboot Notice" admin@example.com

# Broadcast to logged-in users
wall "System will reboot in 5 minutes for scheduled maintenance"

Check Reboot Logs

cat /var/log/reboot.log

Disable Daily Reboot

Remove cron job:

sudo crontab -e

Delete or comment out the line.

💡 Instead of daily reboots, consider troubleshooting high memory usage or add swap space.

Was this article helpful?