webdevelopment server script

Here is a small script I made for starting Apache & MySQL services in linux.

#!/bin/bash
# /etc/rc.d/webdev
# Website Start/Stop Script
#
# B.Walden 14/03/2009
 
# Colors
blue="\033[1;34m"
green="\033[1;32m"
red="\033[1;31m"
bold="\033[1;37m"
reset="\033[0m"
 
# Check for root
if [ $(whoami) != "root" ]; then
echo -e $red"error:$reset you cannot perform this operation unless you are root."
exit 1
fi
 
case "$1" in
start)
/etc/rc.d/mysqld start
/etc/rc.d/httpd start
;;
stop)
/etc/rc.d/mysqld stop
/etc/rc.d/httpd stop
;;
restart)
$0 stop
sleep 3
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
 
exit 0
No comments yet.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">