Skip to content

Instantly share code, notes, and snippets.

@inlanger
Created August 1, 2013 07:00
Show Gist options
  • Save inlanger/6129030 to your computer and use it in GitHub Desktop.
Save inlanger/6129030 to your computer and use it in GitHub Desktop.
Apache and MySQL process state monitor and reloader.
#!/bin/bash
# APACHE SECTION
RESTART="/etc/init.d/apache2 restart"
PGREP="/usr/bin/pgrep"
HTTPD="apache"
$PGREP ${HTTPD}
if [ $? -ne 0 ]
then
$RESTART
fi
# MYSQL SECTION
RESTARTM="/etc/init.d/mysql restart"
MYSQLD="mysqld"
$PGREP ${MYSQLD}
if [ $? -ne 0 ]
then
$RESTARTM
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment