Parent Directory
|
Revision Log
Revision 2980 - (view) (download)
| 1 : | sh002i | 658 | #!/bin/sh |
| 2 : | sh002i | 1663 | ################################################################################ |
| 3 : | # WeBWorK Online Homework Delivery System | ||
| 4 : | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ | ||
| 5 : | sh002i | 2503 | # $CVSHeader: webwork2/bin/wwapachectl.dist,v 1.11 2004/07/12 16:09:52 sh002i Exp $ |
| 6 : | sh002i | 1663 | # |
| 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 : | sh002i | 658 | |
| 18 : | sh002i | 2492 | # 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 : | sh002i | 661 | HTTPD=/usr/local/sbin/httpd |
| 29 : | sh002i | 658 | |
| 30 : | sh002i | 2492 | # The path to your personal webwork2 directory |
| 31 : | sh002i | 2500 | WEBWORKROOT=$HOME/webwork2 |
| 32 : | sh002i | 2492 | |
| 33 : | sh002i | 2181 | # If you're sharing files with systems being run by other users, uncomment this |
| 34 : | #umask 2 | ||
| 35 : | |||
| 36 : | sh002i | 2492 | # Change these only if you need to customize the locations |
| 37 : | CONFIG=$WEBWORKROOT/conf/devel.apache-config | ||
| 38 : | sh002i | 658 | PID=$WEBWORKROOT/logs/httpd.pid |
| 39 : | sh002i | 2208 | GLOBAL=$WEBWORKROOT/conf/global.conf |
| 40 : | DATABASE=$WEBWORKROOT/conf/database.conf | ||
| 41 : | sh002i | 658 | |
| 42 : | sh002i | 2492 | ################################################################################ |
| 43 : | # Implementation | ||
| 44 : | ################################################################################ | ||
| 45 : | |||
| 46 : | sh002i | 658 | usage() { |
| 47 : | sh002i | 800 | echo "$0 { start | stop | restart | graceful | configtest }" |
| 48 : | sh002i | 658 | } |
| 49 : | |||
| 50 : | sh002i | 1178 | checkpid() { |
| 51 : | if [ ! -e $PID ]; then | ||
| 52 : | echo "$PID: not found. (Perhaps the server is not running?)" | ||
| 53 : | exit | ||
| 54 : | fi | ||
| 55 : | } | ||
| 56 : | |||
| 57 : | checknopid() { | ||
| 58 : | if [ -e $PID ]; then | ||
| 59 : | echo "$PID: exists. (Perhaps the server is already running?)" | ||
| 60 : | exit | ||
| 61 : | fi | ||
| 62 : | } | ||
| 63 : | |||
| 64 : | sh002i | 2208 | checkconf() { |
| 65 : | if [ $1.dist -nt $1 ]; then | ||
| 66 : | sh002i | 2503 | echo "WARNING: "`basename $1.dist`" is newer than "`basename $1`": UPDATE "`basename $1`"!" |
| 67 : | sh002i | 2208 | fi |
| 68 : | } | ||
| 69 : | |||
| 70 : | sh002i | 658 | case $1 in |
| 71 : | start) | ||
| 72 : | sh002i | 1178 | checknopid |
| 73 : | sh002i | 2208 | checkconf $GLOBAL |
| 74 : | checkconf $DATABASE | ||
| 75 : | sh002i | 2492 | "$HTTPD" -f "$CONFIG" |
| 76 : | sh002i | 658 | ;; |
| 77 : | stop) | ||
| 78 : | sh002i | 1178 | checkpid |
| 79 : | sh002i | 2492 | kill -TERM `cat "$PID"` |
| 80 : | sh002i | 658 | ;; |
| 81 : | restart) | ||
| 82 : | sh002i | 1178 | checkpid |
| 83 : | sh002i | 2208 | checkconf $GLOBAL |
| 84 : | checkconf $DATABASE | ||
| 85 : | sh002i | 2492 | kill -HUP `cat "$PID"` |
| 86 : | sh002i | 658 | ;; |
| 87 : | graceful) | ||
| 88 : | sh002i | 1178 | checkpid |
| 89 : | sh002i | 2492 | kill -USR1 `cat "$PID"` |
| 90 : | sh002i | 2208 | checkconf $GLOBAL |
| 91 : | checkconf $DATABASE | ||
| 92 : | sh002i | 658 | ;; |
| 93 : | configtest) | ||
| 94 : | sh002i | 2492 | "$HTTPD" -t -f "$CONFIG" |
| 95 : | sh002i | 658 | ;; |
| 96 : | *) | ||
| 97 : | usage | ||
| 98 : | ;; | ||
| 99 : | esac |
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |