stijn
By: a guest | Aug 6th, 2009 | Syntax:
Bash | Size: 0.82 KB | Hits: 143 | Expires: Never
#!/bin/bash
#
# Start Apache and/or Mysql server
apache=/etc/init.d/apache2
mysql=/etc/init.d/mysql
case $1 in
"start")
if [ "$2" = "apache" ] || [ "$3" = "apache" ] ; then
gksudo $apache start &> /dev/null
echo "Apache started!"
fi
if [ "$2" = "mysql" ] || [ "$3" = "mysql" ] ; then
gksudo $mysql start &> /dev/null
echo "Mysql started!"
fi;;
"stop")
if [ "$2" = "apache" ] || [ "$3" = "apache" ] ; then
gksudo $apache stop &> /dev/null
echo "Apache stopped!"
fi
if [ "$2" = "mysql" ] || [ "$3" = "mysql" ] ; then
gksudo $mysql stop &> /dev/null
echo "Mysql stopped!"
fi;;
*)
echo "Usage: lamp.sh start|stop apache mysql";;
esac