1 #!/bin/bash
2 #
3 # httpd Startup script for the Apache HTTP Server
4 #
5 # chkconfig: - 85 15
6 # description: Apache is a World Wide Web server. It is used to serve \
7 # HTML files and CGI.
8 # processname: httpd
9 # config: /etc/httpd/conf/httpd.conf
10 # config: /etc/sysconfig/httpd
11 # pidfile: /var/run/httpd.pid
12
13 # Source function library.
14 . /etc/rc.d/init.d/functions
15
16 if [ -f /etc/sysconfig/httpd ]; then
17 . /etc/sysconfig/httpd
18 fi
19
20 # Start httpd in the C locale by default.
21 HTTPD_LANG=${HTTPD_LANG-"C"}
22
23 # This will prevent initlog from swallowing up a pass-phrase prompt if
24 # mod_ssl needs a pass-phrase from the user.
25 INITLOG_ARGS=""
26
27 # Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
28 # with the thread-based "worker" MPM; BE WARNED that some modules may not
29 # work correctly with a thread-based MPM; notably PHP will refuse to start.
30
31 # Path to the apachectl script, server binary, and short-form for messages.
32 apachectl=/usr/local/apache2/bin/apachectl
33 httpd=${HTTPD-/usr/local/apache2/bin/httpd}
34 prog=httpd
35 pidfile=${PIDFILE-/var/run/httpd.pid}
36 lockfile=${LOCKFILE-/var/lock/subsys/httpd}
37 RETVAL=0
38
39 # check for 1.3 configuration
40 check13 () {
41 CONFFILE=/usr/local/apache2/conf/httpd.conf
42 GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
43 GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
44 GONE="${GONE}AccessConfig|ResourceConfig)"
45 if LANG=C grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then
46 echo
47 echo 1>&2 " Apache 1.3 configuration directives found"
48 echo 1>&2 " please read /usr/share/doc/httpd-2.0.52/migration.html"
49 failure "Apache 1.3 config directives test"
50 echo
51 exit 1
52 fi
53 }
54
55 # The semantics of these two functions differ from the way apachectl does
56 # things -- attempting to start while running is a failure, and shutdown
57 # when not running is also a failure. So we just do it the way init scripts
58 # are expected to behave here.
59 start() {
60 echo -n $"Starting $prog: "
61 check13 || exit 1
62 LANG=$HTTPD_LANG daemon $httpd $OPTIONS
63 RETVAL=$?
64 echo
65 [ $RETVAL = 0 ] && touch ${lockfile}
66 return $RETVAL
67 }
68 stop() {
69 echo -n $"Stopping $prog: "
70 killproc $httpd
71 RETVAL=$?
72 echo
73 [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
74 }
75 reload() {
76 echo -n $"Reloading $prog: "
77 if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
78 RETVAL=$?
79 echo $"not reloading due to configuration syntax error"
80 failure $"not reloading $httpd due to configuration syntax error"
81 else
82 killproc $httpd -HUP
83 RETVAL=$?
84 fi
85 echo
86 }
87
88 # See how we were called.
89 case "$1" in
90 start)
91 start
92 ;;
93 stop)
94 stop
95 ;;
96 status)
97 status $httpd
98 RETVAL=$?
99 ;;
100 restart)
101 stop
102 start
103 ;;
104 condrestart)
105 if [ -f ${pidfile} ] ; then
106 stop
107 start
108 fi
109 ;;
110 reload)
111 reload
112 ;;
113 graceful|help|configtest|fullstatus)
114 $apachectl $@
115 RETVAL=$?
116 ;;
117 *)
118 echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
119 exit 1
120 esac
121
122 exit $RETVAL
---------------------------------------------------------------------------------------------------------------------------------
说人之短,乃护己之短。夸己之长,乃忌人之长。皆由存心不厚,识量太狭耳。能去此弊,可以进德,可以远怨。
http://www.blogjava.net/szhswl
------------------------------------------------------------------------------------------------------ ----------------- ---------
posted on 2007-12-12 21:58
宋针还 阅读(680)
评论(0) 编辑 收藏 所属分类:
操作系统