当前位置: > Linux服务器 > apache >

apache(with perl)的启动脚本一例

时间:2014-09-08 23:01来源:linux.it.net.cn 作者:it

apache(with perl)的启动脚本一例

复制代码代码如下:

# Start of /etc/rc.d/init.d/httpd
#!/bin/sh
#
# Startup script for the Apache Web Server
#
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# pidfile: /var/run/httpd.pid
# config: /etc/httpd/conf/access.conf
# config: /etc/httpd/conf/httpd.conf
# config: /etc/httpd/conf/srm.conf

# Source function library.
. /etc/rc.d/init.d/functions

# Path to the httpd binary.
httpd=/usr/sbin/httpd
httpdperl=/usr/sbin/httpd.perl
RETVAL=0

# Until glibc's ros support is working right again, work around it.
LANG=C

# Change the major functions into functions.
moduleargs() {
moduledir=/usr/lib/apache
moduleargs=
for module in ${moduledir}","");\
gsub("^mod_","");\
gsub("^lib","");\
gsub("\.so$","");\
print toupper($0)}'`
moduleargs="${moduleargs} -D HAVE_$module"
fi
done
echo ${moduleargs}
}
start() {
echo -n "Starting httpd: "
daemon ${httpd} `moduleargs`
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
return $RETVAL
}
startperl() {
echo -n "Starting httpd.perl: "
daemon ${httpdperl} -f /etc/httpd/conf/httpd.conf.perl `moduleargs`
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/httpd.perl
return $RETVAL
}
stop() {
echo -n "Shutting down http: "
killproc httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid /var/lock/subsys/httpd.perl /var/run/httpd.pid.perl
}
stopperl() {
echo -n "Shutting down http.perl: "
killproc httpd.perl
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd.perl /var/run/httpd.pid.perl
}

# See how we were called.
case "$1" in
start)
start
startperl
;;
stop)
stopperl
stop
;;
startperl)
startperl
;;
stopperl)
stopperl
;;
status)
status ${httpd}
status ${httpdperl}
;;
restart)
stopperl
stop
start
startperl
;;
restartperl)
stopperl
startperl
;;
reload)
echo -n "Reloading httpd: "
killproc ${httpd} -HUP
killproc ${httpdperl} -HUP
RETVAL=$?
echo
;;
condrestart)
if [ -f /var/run/httpd.pid.perl ] ; then
stopperl
startperl
fi
if [ -f /var/run/httpd.pid ] ; then
stop
start
fi
;;
*)
echo "Usage: $0 {start|stop|restart|startperl|stopperl|restartperl|reload|condrestart|status}"
exit 1
esac

exit $RETVAL
# End of /etc/rc.d/init.d/httpd


(责任编辑:IT)
------分隔线----------------------------