Skip to content
WJunction - Webmaster Forum

Automatically restart Apache & MySQL

Status
Not open for further replies.
This is pretty useful for people who are lazy and don't want to fix an underlying problem (usually a script that has a memory leak or if you want your website to run more efficient but don't want to pay more)

Login as root via SSH and do the following (These commands designed for Ubuntu/Linux with nano installed):

Code:
cd /
mkdir commands
cd commands
nano reboot.sh
Paste:
Code:
#!/bin/sh
/etc/init.d/apache2 restart
/etc/init.d/mysql restart
Code:
ctrl + x
y
return button/enter button
chmod +x reboot.sh
crontab -e
Paste:
Code:
59 * * * * /commands/reboot.sh
59 * * * * /commands/reboot.sh

59 is for minutes, second (*) is for hours, third (*) is for days and fourth (*) is for months and fifth (*) is for day in the week (0 = sunday, 6 = saturday)
 
Last edited:

1 comment

Status
Not open for further replies.

About the author

Sp32
Active Member · Joined
3,652
Messages
1,326
Reactions
113
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom