#!/bin/bash
# httpd Starts/stop the at daemon
#chkconfig: 345 61 29
#description: Runs Apache as httpd
#Source function Library
. /etc/init.d/functions
Exec=/usr/local/apache2/bin/httpd
Prog= "httpd"
Config=/usr/local/apache2/conf/httpd.conf
lockfile=/var/lock/subsys/$prog
Start ()
{
[-X $exec] | | Exit 5
[-f $config] | | Exit 6
[-F $lockfile] && echo "HTTP has running ..." && exit 7
Echo-n $ "Starting $prog .... "
Sleep 1
$exec-K Start
[$?-eq 0] && touch $lockfile && echo-e "\033[31m ok \033[0m" | | echo-e "\033[31m Failure \033[0m"
}
Stop ()
{
Echo-n "httpd is stoping ..."
Sleep 1
Killproc $prog >/dev/null && rm-f $lockfile && echo-e "\033[31m ok \033[0m" | | Echo-e "\033[31m faiure stop \033[0m"
}
Restart ()
{
Stop
Start
}
Status ()
{
[-F $lockfile] && echo "httpd is running ..." | | echo "httpd has stoping ..."
}
Case "$" in
Start
start;;
Stop
stop;;
Restart
restart;;
Status
status;;
*)
echo "Usage./httpd {Start|stop|restart|status}"
;;
Esac
http2.4 startup script