head	1.12;
access;
symbols;
locks; strict;
comment	@# @;


1.12
date	2000.09.20.19.44.38;	author dlr;	state dead;
branches;
next	1.11;

1.11
date	2000.09.20.16.39.52;	author leonardr;	state Exp;
branches;
next	1.10;

1.10
date	2000.09.19.20.50.57;	author ms;	state dead;
branches;
next	1.9;

1.9
date	2000.09.18.19.04.44;	author ms;	state Exp;
branches;
next	1.8;

1.8
date	2000.08.23.11.07.17;	author ed;	state dead;
branches;
next	1.7;

1.7
date	2000.07.12.18.16.20;	author jon;	state Exp;
branches;
next	1.6;

1.6
date	2000.07.12.05.28.18;	author jrobbins;	state Exp;
branches;
next	1.5;

1.5
date	2000.07.11.09.05.50;	author davidp;	state Exp;
branches;
next	1.4;

1.4
date	2000.07.06.00.45.09;	author elicia;	state Exp;
branches;
next	1.3;

1.3
date	2000.06.22.23.15.29;	author davidp;	state Exp;
branches;
next	1.2;

1.2
date	2000.06.09.02.47.51;	author dlr;	state Exp;
branches;
next	1.1;

1.1
date	2000.06.03.05.55.42;	author davidp;	state Exp;
branches;
next	;


desc
@@


1.12
log
@Accidently added by Leonard.  This script is generated by configure.pl and sandboxctl.in.
@
text
@#!/bin/bash
#
# sandboxctl        Controls the sandbox webserver
#
# Description: Starts and stops the apache webserver for this sandbox.  Saves
# off old log files into an archive directory.
#
# Jserv can be started manually or automatically.  Starting sutomatically is
# easiest, and appropriate for development environments.  High volume production
# installations may need to take advantage of jserv's load balancing, in which
# case the jserv's comprising the balance set must be started manually.  For
# starting manually, uncomment the lines starting with #[manual].  Of course,
# you will need to make changes to your jserv.conf too, but that's beyond the
# scope of this discussion.  :^)
#

# Save your PATH, it will get munged
MYPATH=$PATH

# Source the function library.
. /etc/rc.d/init.d/functions

# Okay, let's fix the path, but pre-pend whatever they set in the "functions"
# file so that we keep our environment as close as possible to theirs (but no
# closer, apologies to Albert Einstein).
PATH=$PATH:$MYPATH

. /usr/local/tigris/scripts/env.sh

#
# The suffix pertains to the identifier that mod_jserv appends to the session
# ID when doing load balancing across jserv processes that have been started
# manually.  This is not an issue when a single jserv is started automatically
# when apache starts.
#
# The suffix should match the ApJServRoute designation in jserv.conf, just to
# help you keep things straight, but is not required to.
#
#[manual] suffix=A

#
# The command here can be either "start" or "startssl" depending on whether
# apache has been configured for SSL support.
#
#command=startssl
command=start

# Path to the sandbox scripts directory.
SCRIPTS=${SANDBOX}/scripts

[ -x ${SCRIPTS}/apachectl ] || (echo "Can't find apachectl"; exit 0)
#[manual] [ -f /usr/local/apache/bin/start${suffix}1 ] || exit 0
#[manual] [ -f /usr/local/apache/bin/start${suffix}2 ] || exit 0

# See how we were called.
case "$1" in
  start)
	echo "Starting the jserv processes: "

	# First, save off the old log files
	LOGDIR=${SANDBOX}/log
	ARCHDIR=${SANDBOX}/log_archive
	mkdir -p -m 774 --verbose $ARCHDIR
        if [ "x$IN_PRODUCTION" = "xfalse" ]; then
	    DATEDIR=$ARCHDIR/$(date +%Y%m%d.%H%M)
	    mkdir -p -m 774 --verbose $DATEDIR
            mv -f $LOGDIR/*log* $LOGDIR/*ssl* $DATEDIR/
        fi

	# Create the jserv log files and give them the proper ownership
	#[manual] touch $LOGDIR/jserv${suffix}1.log
	#[manual] touch $LOGDIR/jserv${suffix}2.log
	touch ${LOGDIR}/ssl_scache.db

	# next, start jserv
	#[manual] /usr/local/apache/bin/start${suffix}1
	#[manual] /usr/local/apache/bin/start${suffix}2
	echo
	# next, start apache
	echo -n "Starting apache webserver: "
	${SCRIPTS}/apachectl ${command}
	echo

	# Now let's change the ownerships in the log file
	# This is not really a fix because apache creates files 
	# owned as root but then the child processes--pure httpd--cannot
	# append to them (directory setgid & t bits notwithstanding)
	#[manual] chown httpd:httpd $LOGDIR/*
	;;
  stop)
	echo -n "Shutting apache webserver: "
	${SCRIPTS}/apachectl stop
	echo making sure the webserver and jvms are stopped
        ${SCRIPTS}/reliable_shutdown.pl
	#[manual] echo -n "Shutting down jserv processes: "
	#[manual] killproc java_ns
	echo
	;;
  status)
	echo 'Apache processes...'
	ps -e | grep http
	echo 'JServ processes...'
	ps -e | grep java
	;;
  restart)
	$0 stop
	$0 start
	;;
  *)
	echo "Usage: sandboxctl {start|stop|status|restart}"
	exit 1
esac

exit 0

@


1.11
log
@"fi" statement was incorrectly commented out, breaking startup script.
@
text
@@


1.10
log
@Accidently added sandboxctl rather then sandboxctl.in.
Also made sandbox reloading faster
Submitted by:	Michael Salmon
Reviewed by:	Michael Stack
@
text
@d19 1
a19 1
USER=`whoami`
d28 1
a28 1
. /home/ms/sandbox/scripts/env.sh
d64 1
a64 1
        if [ -z $PRODUCTION ]; then
d101 1
a101 1
	ps -U $USER | grep http
d103 1
a103 1
	ps -U $USER | grep java
@


1.9
log
@Removed useless "sleep(10);"
Submitted by:	Michael Salmon
Reviewed by:	Ed K.
@
text
@@


1.8
log
@add new script for generating conf files based on ordered files w/in
specified directories.

remove sandboxctl, which shouldn't be in the cvs repository.
@
text
@d19 1
a19 1

d28 2
d64 5
a68 4
	DATEDIR=$ARCHDIR/$(date +%Y%m%d.%H%M)
	mkdir -p -m 774 --verbose $DATEDIR
	mv -f ${LOGDIR}/*log* $DATEDIR
	mv -f ${LOGDIR}/*ssl* $DATEDIR
d93 2
a94 1
	echo
d101 1
a101 1
	ps -e | grep http
d103 1
a103 1
	ps -e | grep java
a106 1
	sleep 10
@


1.7
log
@don't complain if these files don't exist
@
text
@@


1.6
log
@logs --> log
@
text
@d64 2
a65 2
	mv ${LOGDIR}/*log* $DATEDIR
	mv ${LOGDIR}/*ssl* $DATEDIR
@


1.5
log
@increased the sleep between stop and start for restart => 10 seconds
@
text
@d43 2
a44 2
command=startssl
#command=start
d59 1
a59 1
	LOGDIR=${SANDBOX}/logs
@


1.4
log
@changed sleep time between stop and start on a restart
PR:
Obtained from:
Submitted by:
Reviewed by:
@
text
@d103 1
a103 1
	sleep 6
@


1.3
log
@Support for sandbox-specific ssl (https) ports.
@
text
@d103 1
a103 1
	sleep 5
@


1.2
log
@Should now--hopefully--be able to run this script from any directory.
@
text
@d43 2
a44 2
command=start
#command=startssl
@


1.1
log
@Mimics the functionality of the sourcex script on sourceXchange servers.
Provides functionality to start, stop, restart, and display status.
Uses apachectl to start/stop apache.  Saves off existing log files into
log_archive directory.  Sections dealing with starting jserv manually are
commented out for now, but may be uncommented for future use.
@
text
@d19 2
d22 1
a27 1

d43 1
a44 1
command=start
d46 4
a49 1
[ -f ./apachectl ] || exit 0
d59 2
a60 2
	LOGDIR=$SANDBOX/logs
	ARCHDIR=$SANDBOX/log_archive
d64 2
a65 2
	mv $LOGDIR/*log* $DATEDIR
	mv $LOGDIR/*ssl* $DATEDIR
d70 1
a70 1
	touch $LOGDIR/ssl_scache.db
d78 1
a78 1
	./apachectl ${command}
d89 1
a89 1
	./apachectl stop
d96 1
a96 1
	echo Apache processes ...
d98 1
a98 1
	echo JServ processes ...
@

