Last active
August 29, 2015 14:00
-
-
Save nathandarnell/e4a34b3b32008aa3d407 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 | |
## Author: RonB123123 | |
## Created: Sept 24, 2008 | |
## Description: | |
## Checks if the MySQL + Apache services are running, if not | |
## not then start each service. | |
##From http://ubuntuforums.org/showthread.php?t=928475 | |
echo "Options" | |
echo "1 - Start" | |
echo "2 - Stop" | |
read option | |
SERVICES="avahi-daemon deluge-daemon cron" | |
# check if each service is running | |
for service in $SERVICES | |
do | |
if [ "$option" == 2 ] | |
then | |
echo "Stopping $service..." | |
sudo /etc/init.d/$service stop | |
elif [ "$option" == 1 ] | |
then | |
echo "Starting $service..." | |
sudo /etc/init.d/$service start | |
fi | |
if (ps ax | grep -v grep | grep $service > /dev/null) | |
then | |
echo "$service is running." | |
else | |
echo "$service is not running." | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment