教程集 www.jiaochengji.com
教程集 >  脚本编程  >  shell  >  正文 apache(with perl)的启动脚本一例

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

发布时间:2014-09-04   编辑:jiaochengji.com
apache(with perl)的启动脚本一例,供大家学习参考。

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

您可能感兴趣的文章:
apache(with perl)的启动脚本一例
perl文件锁使脚本以单实例运行
《Perl编程24学时教程》笔记第17课 perl的CGI概述
常用的php集成环境有哪些
Centos下PHP5升级为PHP7的方法
fastcgi与cgi有什么区别?
lighttpd中配置FastCGI环境
动态网页制作技术PHP的十个应用技巧
mysqlhotcopy错误Can’t locate DBI.pm的解决方法
lighttpd配置url重写一例

[关闭]
~ ~