Parent Directory
|
Revision Log
remove stale pidfiles on stop
1 #!/bin/sh 2 ################################################################################ 3 # WeBWorK Online Homework Delivery System 4 # Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ 5 # $CVSHeader: webwork2/bin/wwapache2ctl.dist,v 1.3 2007/08/13 22:59:50 sh002i Exp $ 6 # 7 # This program is free software; you can redistribute it and/or modify it under 8 # the terms of either: (a) the GNU General Public License as published by the 9 # Free Software Foundation; either version 2, or (at your option) any later 10 # version, or (b) the "Artistic License" which comes with this package. 11 # 12 # This program is distributed in the hope that it will be useful, but WITHOUT 13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 # FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the 15 # Artistic License for more details. 16 ################################################################################ 17 18 # This is a wrapper for the apachectl utility suitable for use when doing 19 # development on the WeBWorK 2 system. This setup allows each developer to run 20 # an independent Apache server under their own UID, using their own working copy 21 # of the WeBWorK code. 22 23 ################################################################################ 24 # Configuration 25 ################################################################################ 26 27 # The path to the Apache binary 28 HTTPD=/usr/local/apache2/bin/httpd 29 30 # The path to your personal webwork2 directory 31 WEBWORKROOT=$HOME/webwork2 32 33 # If you're sharing files with systems being run by other users, uncomment this 34 #umask 2 35 36 # if you want to use SSL, uncomment this line 37 #SSL=-DSSL 38 39 # Change these only if you need to customize the locations 40 PID=$WEBWORKROOT/logs/httpd2.pid 41 CONFIG_GLOBAL=$WEBWORKROOT/conf/global.conf 42 CONFIG_DATABASE=$WEBWORKROOT/conf/database.conf 43 CONFIG_DEVEL=$WEBWORKROOT/conf/devel.apache2-config 44 CONFIG_DEVEL_SITE=$WEBWORKROOT/conf/devel-site.apache2-config 45 CONFIG_WEBWORK=$WEBWORKROOT/conf/webwork.apache2-config 46 CONFIG_THISFILE=$WEBWORKROOT/bin/wwapache2ctl 47 48 ################################################################################ 49 # Implementation 50 ################################################################################ 51 52 usage() { 53 echo "$0 { start | stop | restart | graceful | configtest }" 54 } 55 56 checkpid() { 57 if [ ! -e $PID ]; then 58 echo "$PID: not found. (Perhaps the server is not running?)" 59 exit 60 fi 61 } 62 63 checknopid() { 64 if [ -e $PID ]; then 65 echo "$PID: exists. (Perhaps the server is already running?)" 66 exit 67 fi 68 } 69 70 checkconfs() { 71 for conf in "$@"; do 72 checkconf "$conf" 73 done 74 } 75 76 checkconf() { 77 if [ $1.dist -nt $1 ]; then 78 echo "WARNING: "`basename $1.dist`" is newer than "`basename $1`": UPDATE "`basename $1`"!" 79 fi 80 } 81 82 case $1 in 83 start) 84 checknopid 85 checkconfs "$CONFIG_GLOBAL" "$CONFIG_DATABASE" "$CONFIG_DEVEL" "$CONFIG_DEVEL_SITE" "$CONFIG_WEBWORK" "$CONFIG_THISFILE" 86 mkdir -pv "$WEBWORKROOT"/run # hack for httpd.mm 87 "$HTTPD" $SSL -d "$WEBWORKROOT" -f "$CONFIG_DEVEL" 88 ;; 89 stop) 90 checkpid 91 kill -TERM `cat "$PID"` 92 rm -f "$PID" 93 ;; 94 restart) 95 checkpid 96 checkconfs "$CONFIG_GLOBAL" "$CONFIG_DATABASE" "$CONFIG_DEVEL" "$CONFIG_DEVEL_SITE" "$CONFIG_WEBWORK" "$CONFIG_THISFILE" 97 kill -HUP `cat "$PID"` 98 ;; 99 graceful) 100 checkpid 101 checkconfs "$CONFIG_GLOBAL" "$CONFIG_DATABASE" "$CONFIG_DEVEL" "$CONFIG_DEVEL_SITE" "$CONFIG_WEBWORK" "$CONFIG_THISFILE" 102 kill -USR1 `cat "$PID"` 103 ;; 104 configtest) 105 "$HTTPD" $SSL -d "$WEBWORKROOT" -f "$CONFIG_DEVEL" -t 106 ;; 107 *) 108 usage 109 ;; 110 esac
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |