#!/bin/bash 
 # 
 # chkconfig: 2345 85 15 
 # description: Start script for Apache 
 # processname: 

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

 self=httpd

 ## the root of the web tree 
 chrt=/www

 ## the path to the startup script inside the chroot env. 
 cmd=/www/apache/bin/apachectl
 logs=/w/apa/var/logs

 ## the status url with the hostname embedded (in this case, 'ns') 
  statusurl="http://ns/server-status"
 ## NOTE: lynx must be in root's path to use the status options. 
 ##       otherwise, just hard code the path into this script.. 

 ## set a umask if you want to hide your files from local users
 # umask 007

  case  "$1" in
   start)
 	 echo -n  "Starting Apache services on ports 80 + 443:  " 
 	/bin/rm $logs/ssl_mutex.* 2>/dev/null  ## clean up ssl_mutex files
 	chroot $chrt $cmd startssl
 	 echo
 	touch /var/lock/subsys/httpd
 	;;
   stop)
 	 echo -n  "Shutting down Apache services:  " 
 	chroot $chrt $cmd stop
 	rm -f /var/lock/subsys/httpd
 	 echo
 	;;
   restart|reload)
 	$0 stop
 	$0 start
 	;;
   status)
 	lynx -dump $statusurl | awk  ' /process$/ { print; exit } { print }  ' 
 	;;
   fullstatus)
 	lynx -dump $statusurl
 	;;
   *)
 	 echo  "Usage: $self  {start|stop|status|fullstatus|restart|reload}" 
 	 exit 1
  esac

  exit 0