Skip to content

Instantly share code, notes, and snippets.

@niag
Last active September 19, 2019 06:51
Show Gist options
  • Save niag/aeda610c2212aae418947c9a09de895f to your computer and use it in GitHub Desktop.
Save niag/aeda610c2212aae418947c9a09de895f to your computer and use it in GitHub Desktop.
#!/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
@niag
Copy link
Author

niag commented Sep 19, 2019

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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment