36 lines
631 B
Bash
36 lines
631 B
Bash
#!/bin/sh
|
|
Green='\033[0;32m'
|
|
Color_Off='\033[0m'
|
|
Red='\033[0;31m'
|
|
|
|
case "$1" in
|
|
start)
|
|
printf "Starting httpd "
|
|
httpd -h /srv/www &> /dev/null
|
|
if [[ "$?" == "0" ]]; then
|
|
printf "[$Green OK $Color_Off]\n"
|
|
else
|
|
printf "[$Red ERR $Cpolor_Off]\n"
|
|
fi
|
|
;;
|
|
stop)
|
|
printf "Stopping httpd "
|
|
killall httpd
|
|
#kill $(cat /var/run/httpd.pid)
|
|
#rm /var/run/httpd.pid
|
|
if [[ "$?" == "0" ]]; then
|
|
printf "[$Green OK $Color_Off]\n"
|
|
else
|
|
printf "[$Red ERR $Color_Off]\n"
|
|
fi
|
|
;;
|
|
restart|reload)
|
|
"$0" stop
|
|
"$0" start
|
|
;;
|
|
*)
|
|
echo "httpd init script usage: $0 {start|stop|restart}"
|
|
return 1
|
|
esac
|
|
return $?
|