1 #!/bin/bash 2 # 3 # Startup script for the Openfiler web interface 4 # 5 # chkconfig: - 85 15 6 # description: Openfiler web interface 7 # processname: openfiler 8 # pidfile: /opt/openfiler/var/run/openfiler.pid 9 # config: /opt/openfiler/etc/httpd/conf/httpd.conf 10 11 # Source function library. 12 . /etc/init.d/functions 13 14 if [ -f /opt/openfiler/etc/sysconfig/openfiler ]; then 15 . /opt/openfiler/etc/sysconfig/openfiler 16 fi 17 18 # This will prevent initlog from swallowing up a pass-phrase prompt if 19 # mod_ssl needs a pass-phrase from the user. 20 INITLOG_ARGS="" 21 22 # Path to the apachectl script, server binary, and short-form for messages. 23 apachectl=/usr/sbin/apachectl 24 httpd_binary=/opt/openfiler/sbin/openfiler 25 httpd=openfiler 26 prog=openfiler 27 RETVAL=0 28 OPTIONS="${OPTIONS} -f /opt/openfiler/etc/httpd/conf/httpd.conf" 29 CONFFILE="/opt/openfiler/etc/httpd/conf/httpd.conf" 30 # check for 1.3 configuration 31 check13 () { 32 CONFFILE=/opt/openfiler/etc/httpd/conf/httpd.conf 33 GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|" 34 GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|" 35 GONE="${GONE}AccessConfig|ResourceConfig)" 36 if grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then 37 echo 38 echo 1>&2 " Apache 1.3 configuration directives found" 39 echo 1>&2 " please read Apache 2 migration notes." 40 failure "Apache 1.3 config directives test" 41 echo 42 exit 1 43 fi 44 } 45 46 # The semantics of these two functions differ from the way apachectl does 47 # things -- attempting to start while running is a failure, and shutdown 48 # when not running is also a failure. So we just do it the way init scripts 49 # are expected to behave here. 50 start() { 51 echo -n $"Starting $prog: " 52 check13 || exit 1 53 daemon $httpd_binary $OPTIONS 54 RETVAL=$? 55 echo 56 [ $RETVAL = 0 ] && touch /opt/openfiler/var/lock/subsys/openfiler 57 return $RETVAL 58 } 59 stop() { 60 echo -n $"Stopping $prog: " 61 killproc $httpd 62 RETVAL=$? 63 echo 64 [ $RETVAL = 0 ] && rm -f /opt/openfiler/var/lock/subsys/openfiler /opt/openfiler/var/run/openfiler.pid 65 } 66 reload() { 67 echo -n $"Reloading $prog: " 68 check13 || exit 1 69 killproc $httpd -HUP 70 RETVAL=$? 71 echo 72 } 73 74 # See how we were called. 75 case "$1" in 76 start) 77 start 78 ;; 79 stop) 80 stop 81 ;; 82 status) 83 status $httpd 84 RETVAL=$? 85 ;; 86 restart) 87 stop 88 start 89 ;; 90 condrestart) 91 if [ -f /var/run/openfiler.pid ] ; then 92 stop 93 start 94 fi 95 ;; 96 reload) 97 reload 98 ;; 99 configtest) 100 $apachectl -t -f $CONFFILE 101 RETVAL=$? 102 ;; 103 *) 104 echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|configtest}" 105 exit 1 106 esac 107 108 exit $RETVAL