Last active
September 19, 2019 06:51
-
-
Save niag/aeda610c2212aae418947c9a09de895f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PATH=/usr/sbin:/usr/bin:/sbin:/bin | |
/etc/init.d/mysql status | grep 'running' > /dev/null | |
if [ $? != 0 ] | |
then | |
/etc/init.d/apache2 stop && \ | |
/etc/init.d/mysql stop && \ | |
/etc/init.d/mysql start && \ | |
/etc/init.d/apache2 start > /dev/null 2>&1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a small VPS hosting with 128M memory and running LAMP. All memory is used and some time service MySql with database go down. Due to stand some time on this VPS I'm testing reload services by cron.
Revision 2
From line 4 has been removed trailer "2>&1".