[system] / branches / rel-2-4-patches / webwork-modperl / bin / wwapachectl.dist Repository:
ViewVC logotype

View of /branches/rel-2-4-patches/webwork-modperl/bin/wwapachectl.dist

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5734 - (download) (annotate)
Tue Jun 24 00:44:59 2008 UTC (4 years, 11 months ago)
File size: 3530 byte(s)
This commit was manufactured by cvs2svn to create branch 'rel-2-4-patches'.

    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/wwapachectl.dist,v 1.17 2006/05/31 18:25:18 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/sbin/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/httpd.pid
   41 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 
   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" -f "$CONFIG_DEVEL" -d "$WEBWORKROOT" "$SSL"
   88     ;;
   89   stop)
   90     checkpid
   91     kill -TERM `cat "$PID"`
   92     ;;
   93   restart)
   94     checkpid
   95     checkconfs "$CONFIG_GLOBAL" "$CONFIG_DATABASE" "$CONFIG_DEVEL" "$CONFIG_DEVEL_SITE" "$CONFIG_WEBWORK" "$CONFIG_THISFILE"
   96     kill -HUP `cat "$PID"`
   97     ;;
   98   graceful)
   99     checkpid
  100     checkconfs "$CONFIG_GLOBAL" "$CONFIG_DATABASE" "$CONFIG_DEVEL" "$CONFIG_DEVEL_SITE" "$CONFIG_WEBWORK" "$CONFIG_THISFILE"
  101     kill -USR1 `cat "$PID"`
  102     ;;
  103   configtest)
  104     "$HTTPD" -t -f "$CONFIG_DEVEL" -d "$WEBWORKROOT" "$SSL"
  105     ;;
  106   *)
  107     usage
  108     ;;
  109 esac

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9