[system] / trunk / webwork-modperl / bin / wwapachectl.dist Repository:
ViewVC logotype

Annotation of /trunk/webwork-modperl/bin/wwapachectl.dist

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5319 - (view) (download)

1 : sh002i 658 #!/bin/sh
2 : sh002i 1663 ################################################################################
3 :     # WeBWorK Online Homework Delivery System
4 : sh002i 5319 # Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/
5 :     # $CVSHeader: webwork2/bin/wwapachectl.dist,v 1.17 2006/05/31 18:25:18 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 4114 # if you want to use SSL, uncomment this line
37 :     #SSL=-DSSL
38 :    
39 : sh002i 2492 # Change these only if you need to customize the locations
40 : sh002i 658 PID=$WEBWORKROOT/logs/httpd.pid
41 : sh002i 4078 CONFIG_GLOBAL=$WEBWORKROOT/conf/global.conf
42 :     CONFIG_DATABASE=$WEBWORKROOT/conf/database.conf
43 :     CONFIG_DEVEL=$WEBWORKROOT/conf/devel.apache-config
44 :     CONFIG_DEVEL_SITE=$WEBWORKROOT/conf/devel-site.apache-config
45 :     CONFIG_WEBWORK=$WEBWORKROOT/conf/webwork.apache-config
46 :     CONFIG_THISFILE=$WEBWORKROOT/bin/wwapachectl
47 : sh002i 658
48 : sh002i 2492 ################################################################################
49 :     # Implementation
50 :     ################################################################################
51 :    
52 : sh002i 658 usage() {
53 : sh002i 800 echo "$0 { start | stop | restart | graceful | configtest }"
54 : sh002i 658 }
55 :    
56 : sh002i 1178 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 : sh002i 4078 checkconfs() {
71 :     for conf in "$@"; do
72 :     checkconf "$conf"
73 :     done
74 :     }
75 :    
76 : sh002i 2208 checkconf() {
77 :     if [ $1.dist -nt $1 ]; then
78 : sh002i 2503 echo "WARNING: "`basename $1.dist`" is newer than "`basename $1`": UPDATE "`basename $1`"!"
79 : sh002i 2208 fi
80 :     }
81 :    
82 : sh002i 658 case $1 in
83 :     start)
84 : sh002i 1178 checknopid
85 : sh002i 4078 checkconfs "$CONFIG_GLOBAL" "$CONFIG_DATABASE" "$CONFIG_DEVEL" "$CONFIG_DEVEL_SITE" "$CONFIG_WEBWORK" "$CONFIG_THISFILE"
86 : sh002i 4111 mkdir -pv "$WEBWORKROOT"/run # hack for httpd.mm
87 : sh002i 4114 "$HTTPD" -f "$CONFIG_DEVEL" -d "$WEBWORKROOT" "$SSL"
88 : sh002i 658 ;;
89 :     stop)
90 : sh002i 1178 checkpid
91 : sh002i 2492 kill -TERM `cat "$PID"`
92 : sh002i 658 ;;
93 :     restart)
94 : sh002i 1178 checkpid
95 : sh002i 4078 checkconfs "$CONFIG_GLOBAL" "$CONFIG_DATABASE" "$CONFIG_DEVEL" "$CONFIG_DEVEL_SITE" "$CONFIG_WEBWORK" "$CONFIG_THISFILE"
96 : sh002i 2492 kill -HUP `cat "$PID"`
97 : sh002i 658 ;;
98 :     graceful)
99 : sh002i 1178 checkpid
100 : sh002i 4111 checkconfs "$CONFIG_GLOBAL" "$CONFIG_DATABASE" "$CONFIG_DEVEL" "$CONFIG_DEVEL_SITE" "$CONFIG_WEBWORK" "$CONFIG_THISFILE"
101 : sh002i 2492 kill -USR1 `cat "$PID"`
102 : sh002i 658 ;;
103 :     configtest)
104 : sh002i 4114 "$HTTPD" -t -f "$CONFIG_DEVEL" -d "$WEBWORKROOT" "$SSL"
105 : sh002i 658 ;;
106 :     *)
107 :     usage
108 :     ;;
109 :     esac

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9