b1fca0 | 1996-11-12 | Per Hedbor | | #!/bin/sh
|
fd1295 | 1997-09-07 | Henrik Grubbström (Grubba) | | #
|
423fdd | 2000-04-01 | Henrik Grubbström (Grubba) | | # $Id: start,v 1.109 2000/04/01 12:26:30 grubba Exp $
|
67549e | 1999-09-05 | Per Hedbor | |
|
05783b | 1999-09-11 | Martin Stjernholm | | pre="`echo \" $$ \" | sed -e 's/\(.........\)\(.*\)/\1/g'` :"
|
b796b5 | 1998-11-18 | Per Hedbor | |
cd `dirname $0`
|
0a4af8 | 1998-11-28 | Per Hedbor | |
|
b1fca0 | 1996-11-12 | Per Hedbor | | # Can be set with '--config-dir=DIR'
DIR=../configurations/
LOGDIR=../logs/
FILES="default"
|
3e7d3b | 1998-03-20 | Per Hedbor | | program=base_server/roxenloader.pike
|
7c6da6 | 1998-11-01 | Henrik Grubbström (Grubba) | | extra_args=""
|
f29224 | 2000-03-24 | Henrik Grubbström (Grubba) | | VARDIR=../var/
LOCALDIR=../local/
# Make LOCALDIR an absolute path
|
a7b8d7 | 2000-03-24 | Henrik Grubbström (Grubba) | | if test -d $LOCALDIR/.; then
|
4bcae6 | 2000-03-24 | Henrik Grubbström (Grubba) | | LOCALDIR=`cd $LOCALDIR; pwd`
|
64209f | 2000-03-24 | Henrik Grubbström (Grubba) | | else :; fi
|
49fff3 | 2000-01-27 | Henrik Grubbström (Grubba) | |
|
423fdd | 2000-04-01 | Henrik Grubbström (Grubba) | | if test -d $VARDIR/.; then :; else
echo "Creating directory $VARDIR/."
mkdir $VARDIR || exit 1
fi
|
77868d | 2000-03-13 | Per Hedbor | | roxen_version() {
|
bb1978 | 2000-03-29 | Henrik Grubbström (Grubba) | | VERSION="`sed <etc/include/version.h -e '/__roxen_version__/s/[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\)[^0-9]*/\1/p' -n | head -1`"
BUILD="`sed <etc/include/version.h -e '/__roxen_build__/s/[^0-9]*\([0-9][0-9]*\)[^0-9]*/\1/p' -n | head -1`"
|
77868d | 2000-03-13 | Per Hedbor | | echo $VERSION.$BUILD
}
|
f29224 | 2000-03-24 | Henrik Grubbström (Grubba) | | pcdir="$VARDIR/`roxen_version`/precompiled/`uname -m`.`uname -r`"
|
9b1a12 | 2000-02-04 | Per Hedbor | | old_roxen_defines="$pcdir/old_roxen_defines"
./mkdir -p $pcdir
|
b1fca0 | 1996-11-12 | Per Hedbor | |
|
14fd21 | 1998-11-28 | Henrik Grubbström (Grubba) | | # Default verbosity level.
verbose=1
|
48eeb6 | 1999-08-06 | Peter Bortas | | # Do not default to using a relative path.
roxendir="`pwd`"
|
1f66ab | 1998-11-22 | Henrik Grubbström (Grubba) | |
|
d25ab7 | 2000-03-30 | Leif Stensson | | # Locate Pike binary.
|
3b1fab | 2000-02-17 | Per Hedbor | | pike=`type pike|head -1|sed -e 's,.*is ,,'`
|
c90cc9 | 1999-04-22 | Per Hedbor | | if [ -x bin/pike ] ; then pike=$roxendir/bin/pike; fi
if [ -x bin/roxen ] ; then pike=$roxendir/bin/roxen; fi
|
f29224 | 2000-03-24 | Henrik Grubbström (Grubba) | | if [ -x $LOCALDIR/bin/pike ] ; then pike=$LOCALDIR/bin/pike; fi
if [ -x $LOCALDIR/bin/roxen ] ; then pike=$LOCALDIR/bin/roxen; fi
|
c90cc9 | 1999-04-22 | Per Hedbor | | if [ "x$PIKE" = "x" ]; then :; else
if [ -x "$PIKE" ]; then pike="$PIKE"; fi
fi
|
3b1fab | 2000-02-17 | Per Hedbor | |
if [ x"$pike" = "x" ] ; then
echo "No pike binary found. Aborting."
exit 1
fi
if [ ! -f "$pike" ] ; then
echo "No pike binary found. Aborting."
exit 1
fi
|
d25ab7 | 2000-03-30 | Leif Stensson | | # If environment file doesn't exist, try to create it.
if
|
07030c | 2000-03-31 | Leif Stensson | | test ! -f $LOCALDIR/environment && test -f bin/buildenv.pike
|
d25ab7 | 2000-03-30 | Leif Stensson | | then
$pike bin/buildenv.pike
fi
# Set up environment
if test -f $LOCALDIR/environment; then
. $LOCALDIR/environment
fi
# Make sure $CLASSPATH contains the servlet stuff
CLASSPATH=java/classes/roxen_module.jar:java/classes/roxen_servlet.jar:java/classes/servlet.jar:java/classes${CLASSPATH:+:}$CLASSPATH
export CLASSPATH
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | ####### BEGIN ARGUMENT PARSING
|
b1fca0 | 1996-11-12 | Per Hedbor | |
|
2b19eb | 1999-08-20 | Per Hedbor | |
DEFINES="$DEFINES -DKEEP_ALIVE"
|
c90cc9 | 1999-04-22 | Per Hedbor | | # Enable threads (if available) on Solaris.
# Most other OS's have thread bugs that cause them or Roxen to crash.
if uname | grep 'SunOS' >/dev/null 2>&1; then
if uname -r | grep '5\.[5-9]' >/dev/null 2>&1; then
if [ $verbose -gt 0 ] ; then
|
72a450 | 2000-03-10 | Martin Stjernholm | | echo "$pre Solaris 2.5 or later detected. Defaulting to enabled threads."
|
c90cc9 | 1999-04-22 | Per Hedbor | | fi
|
72a450 | 2000-03-10 | Martin Stjernholm | | DEFINES="$DEFINES -DENABLE_THREADS"
|
c90cc9 | 1999-04-22 | Per Hedbor | | fi
fi
|
43583b | 1999-05-25 | Henrik Grubbström (Grubba) | | gdb=no
|
c90cc9 | 1999-04-22 | Per Hedbor | |
|
08cf19 | 1999-09-06 | Per Hedbor | | remove_old_dot_o_files () {
echo "$pre Removing old .o files ($1)"
|
9b1a12 | 2000-02-04 | Per Hedbor | | find $pcdir -name '*.o' | xargs rm -f
|
08cf19 | 1999-09-06 | Per Hedbor | | }
|
b1fca0 | 1996-11-12 | Per Hedbor | | ## Parse all arguments.
|
82f519 | 1997-03-02 | Per Hedbor | | ## GNU-style, long options only, except for -D, simply passed on.
|
754121 | 1999-10-08 | Per Hedbor | | ARGS=""
|
82f519 | 1997-03-02 | Per Hedbor | | parse_args() {
while [ ! c"$1" = "c" ] ; do
|
b1fca0 | 1996-11-12 | Per Hedbor | | case $1 in
|
4019f8 | 1997-03-01 | Per Hedbor | | -D*)
DEFINES="$DEFINES $1"
;;
|
08cf19 | 1999-09-06 | Per Hedbor | | -l*)
|
0272d3 | 1999-11-03 | Henrik Grubbström (Grubba) | | ARGS="$ARGS $1"
|
08cf19 | 1999-09-06 | Per Hedbor | | ;;
|
82f519 | 1997-03-02 | Per Hedbor | | # Used by the 'install' script
|
a41305 | 1998-08-10 | Per Hedbor | | --truss)
pike="truss $pike"
;;
|
df5636 | 1999-08-30 | Per Hedbor | | --truss-c)
pike="truss -c $pike"
;;
|
b1fca0 | 1996-11-12 | Per Hedbor | | --log-dir=*)
LOGDIR=`echo $1 | sed -e 's/--log-dir=//'`
;;
--config-dir=*)
DIR=`echo $1 | sed -e 's/--config-dir=//'`
|
6a8566 | 1997-04-10 | Henrik Grubbström (Grubba) | | FILES=`echo $1 | sed -e's/--config-dir=//' -e's/\.//g' -e's./..g' -e 's.-..g'`
|
b1fca0 | 1996-11-12 | Per Hedbor | | ;;
|
7c6da6 | 1998-11-01 | Henrik Grubbström (Grubba) | | --pid-file=*)
extra_args="$extra_args $1"
;;
|
8a788c | 1998-07-22 | David Hedbor | | '--debug'|'--with-debug'|'--enable-debug')
|
59f64b | 1997-01-27 | Per Hedbor | | debug=1
;;
|
8edfa3 | 1998-08-20 | Per Hedbor | | '--without-debug')
debug=-1
;;
|
8a788c | 1998-07-22 | David Hedbor | | '--fd-debug'|'--with-fd-debug'|'--enable-fd-debug')
|
cc4fdd | 1998-03-26 | Per Hedbor | | DEFINES="-DFD_DEBUG $DEFINES"
;;
|
67549e | 1999-09-05 | Per Hedbor | | '--dump-debug'|'--with-dump-debug'|'--enable-dump-debug')
DEFINES="-DDUMP_DEBUG $DEFINES"
;;
|
8a788c | 1998-07-22 | David Hedbor | | '--threads'|'--with-threads'|'--enable-threads')
|
3c3184 | 1998-03-01 | Per Hedbor | | DEFINES="-DENABLE_THREADS $DEFINES"
;;
|
8a788c | 1998-07-22 | David Hedbor | | '--no-threads'|'--without-threads'|'--disable-threads')
|
72a450 | 2000-03-10 | Martin Stjernholm | | DEFINES="`echo $DEFINES | sed -e 's/-DENABLE_THREADS//g'`"
|
3c3184 | 1998-03-01 | Per Hedbor | | ;;
|
2b19eb | 1999-08-20 | Per Hedbor | | '--no-keep-alive'|'--without-keep-alive'|'--disable-keep-alive')
|
72a450 | 2000-03-10 | Martin Stjernholm | | DEFINES="`echo $DEFINES | sed -e 's/-DKEEP_ALIVE//g'`"
|
2b19eb | 1999-08-20 | Per Hedbor | | ;;
|
8edfa3 | 1998-08-20 | Per Hedbor | | '--with-profile'|'--profile')
|
3c3184 | 1998-03-01 | Per Hedbor | | DEFINES="-DPROFILE $DEFINES"
;;
|
8edfa3 | 1998-08-20 | Per Hedbor | | '--with-file-profile'|'--file-profile')
DEFINES="-DPROFILE -DFILE_PROFILE $DEFINES"
;;
|
8a788c | 1998-07-22 | David Hedbor | | '--keep-alive'|'--with-keep-alive'|'--enable-keep-alive')
|
3c3184 | 1998-03-01 | Per Hedbor | | DEFINES="-DKEEP_ALIVE $DEFINES"
;;
|
14fd21 | 1998-11-28 | Henrik Grubbström (Grubba) | | '--quiet'|'-q')
verbose=0
;;
'--verbose'|'-v')
verbose=2
debug=1
;;
|
221398 | 1999-09-05 | Per Hedbor | | '--remove-dumped')
|
77868d | 2000-03-13 | Per Hedbor | | remove_dumped=1;
|
221398 | 1999-09-05 | Per Hedbor | | ;;
|
a8135b | 1996-11-12 | Per Hedbor | | '--once')
once=1
;;
|
cbced9 | 1998-11-06 | Marcus Comstedt | | # Misspelling --once might give undesirable results, so let's accept
# some "creative" spellings... :-)
'--onve'|'--onec'|'--onev')
once=1
;;
|
c6420b | 1998-06-02 | Henrik Grubbström (Grubba) | | '--gdb')
gdb=gdb
once=1
;;
|
3e7d3b | 1998-03-20 | Per Hedbor | | '--program')
program="$2"
|
0a4af8 | 1998-11-28 | Per Hedbor | | once=1
|
3e7d3b | 1998-03-20 | Per Hedbor | | shift
;;
|
b796b5 | 1998-11-18 | Per Hedbor | | '--cd')
cd_to="$2"
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | # Use the absolute path...
roxendir="`pwd`"
|
0a4af8 | 1998-11-28 | Per Hedbor | | once=1
|
b796b5 | 1998-11-18 | Per Hedbor | | shift
;;
|
bcdd9d | 1999-12-13 | Per Hedbor | | -r*|-d*|-t*|-l*|-w*)
|
754121 | 1999-10-08 | Per Hedbor | | # Argument passed along to Pike.
ARGS="$ARGS $1"
;;
-D*|-M*|-I*|-P*)
|
61c0ca | 1998-11-28 | Henrik Grubbström (Grubba) | | # Argument passed along to Pike.
DEFINES="$DEFINES $1"
;;
|
b1fca0 | 1996-11-12 | Per Hedbor | | '--version')
|
6a5775 | 1999-08-06 | Henrik Grubbström (Grubba) | | if [ -f base_server/roxen.pike ]; then
|
77868d | 2000-03-13 | Per Hedbor | | echo "Roxen `roxen_version`"
|
6a5775 | 1999-08-06 | Henrik Grubbström (Grubba) | | exit 0
else
echo 'base_server/roxen.pike not found!'
exit 1
fi
|
b1fca0 | 1996-11-12 | Per Hedbor | | ;;
'--help'|'-?')
|
ac54c7 | 1999-09-10 | Martin Stjernholm | | sed -e "s/\\.B/`tput 'bold' 2>/dev/null`/g" -e "s/B\\./`tput 'sgr0' 2>/dev/null`/g" << EOF
|
8edfa3 | 1998-08-20 | Per Hedbor | | .BThis command will start the Roxen serverB..
The environment variable .BROXEN_ARGSB. can be used to specify
|
82f519 | 1997-03-02 | Per Hedbor | | the default arguments.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
.BArguments:B.
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | .B--versionB.: Output version information.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
aa5b94 | 1998-11-28 | Henrik Grubbström (Grubba) | | .B--help -?B.: This information.
|
221398 | 1999-09-05 | Per Hedbor | | .B--remove-dumpedB.: Remove all dumped code, thus forcing
a recompile.
|
aa5b94 | 1998-11-28 | Henrik Grubbström (Grubba) | | .B--verbose -vB.: Enable more verbose messages.
.B--quiet -qB.: Disable most of the messages.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | .B--log-dir=DIRB.: Set the log directory. Defaults to .B../logsB..
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
aa5b94 | 1998-11-28 | Henrik Grubbström (Grubba) | | .B--config-dir=DIRB.: Use an alternate configuration directory.
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | Defaults to .B../configurationB..
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | .B--with-threadsB.: If threads are available, use them.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
e6a171 | 2000-02-02 | Per Hedbor | | .B--without-threadsB.: Even if threads are enabled by default,
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | disable them.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | .B--with-profileB.: Store runtime profiling information on
a directory basis. This information is
not saved on permanent storage, it is only
available until the next server restart
This will enable a new 'action' in the
|
a6ef1f | 2000-03-28 | Johan Sundström | | administration interface
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
e6a171 | 2000-02-02 | Per Hedbor | | .B--with-file-profileB.: Like .B--with-profileB., but save information
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | for each and every file.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
e6a171 | 2000-02-02 | Per Hedbor | | .B--with-keep-aliveB.: Enable keep alive in the HTTP
protocol module. This is the default.
Some clients might have problems
|
2b19eb | 1999-08-20 | Per Hedbor | | with keep-alive.
|
e6a171 | 2000-02-02 | Per Hedbor | | .B--without-keep-aliveB.: Disable keep alive in the HTTP
protocol module. Some clients might have
|
2b19eb | 1999-08-20 | Per Hedbor | | problems with keep-alive.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | .B--onceB.: Run the server only once, in the foreground.
This is very useful when debugging.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | .B--gdbB.: Run the server in gdb. Implies .B--onceB..
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | .B--programB.: Start a different program with the roxen
|
e6a171 | 2000-02-02 | Per Hedbor | | Pike. As an example,
.B./start --program bin/install.pikeB. will
start the installation program normally
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | started with .B./installB.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | .B--with-debugB.: Enable debug
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | .B--without-debugB.: Disable all debug
|
e6a171 | 2000-02-02 | Per Hedbor | |
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | .B--with-fd-debugB.: Enable FD debug.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
67549e | 1999-09-05 | Per Hedbor | | .B--with-dump-debugB.: Enable dump debug.
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | .B--trussB.: (Solaris only). Run the server under
|
e6a171 | 2000-02-02 | Per Hedbor | | truss, shows .BallB. system calls. This is
extremely noisy, and is not intented for
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | anything but debug.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
67549e | 1999-09-05 | Per Hedbor | | .B--truss-cB.: (Solaris only). Run the server under
truss -c, shows times for all system calls
|
e6a171 | 2000-02-02 | Per Hedbor | | on exit. This is not intented for anything
|
67549e | 1999-09-05 | Per Hedbor | | but debug. Slows the server down.
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | .B--pid-file=<file>B.: Store the roxen and startscript pids in this
file. Defaults to .B/tmp/roxen_$UIDB.
|
e6a171 | 2000-02-02 | Per Hedbor | |
|
8edfa3 | 1998-08-20 | Per Hedbor | | .BArguments passed to pike:B.
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | .B-DDEFINEB.: Define the symbol .BDEFINEB..
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
61c0ca | 1998-11-28 | Henrik Grubbström (Grubba) | | .B-d<level>B.: Set the runtime Pike debug to level.
|
e6a171 | 2000-02-02 | Per Hedbor | | This only works if Pike is compiled
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | with debug.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
bcdd9d | 1999-12-13 | Per Hedbor | | .B-rtB.: Enable runtime typechecking.
Things will run more slowly, but it is very
useful while developing code.
Enabled when starting roxen with --debug
.B-rTB.: Enable strict types.
|
e6a171 | 2000-02-02 | Per Hedbor | | Same as adding #pragma strict-types
|
bcdd9d | 1999-12-13 | Per Hedbor | | to all files.
This enables more strict
type-checking, things that are
normally permitted (such as calling
a mixed value, or assigning a typed
object variable with an untyped
object) will generate warnings.
Useful for module and roxen core
developers, but not so useful for
the occasional pike-script-writer.
Enabled when starting roxen with --debug
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | .B-s<size>B.: Set the stack size.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
61c0ca | 1998-11-28 | Henrik Grubbström (Grubba) | | .B-M<path>B.: Add the path to the Pike module path.
.B-I<path>B.: Add the path to the Pike include path.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
61c0ca | 1998-11-28 | Henrik Grubbström (Grubba) | | .B-P<path>B.: Add the path to the Pike program path.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
9e8fac | 2000-02-08 | Martin Stjernholm | | .B-dtB.: Turn off tail recursion optimization.
|
adae24 | 1998-09-18 | Per Hedbor | |
|
61c0ca | 1998-11-28 | Henrik Grubbström (Grubba) | | .B-tB.: Turn on Pike level tracing.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
e6a171 | 2000-02-02 | Per Hedbor | | .B-t<level>B.: Turn on more Pike tracing. This only
|
61c0ca | 1998-11-28 | Henrik Grubbström (Grubba) | | works if Pike is compiled with debug.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
0272d3 | 1999-11-03 | Henrik Grubbström (Grubba) | | .B-wB.: Turn on Pike warnings.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
.BEnvironment variables:B.
|
e6a171 | 2000-02-02 | Per Hedbor | | .BLANGB.: Used to determine the default locale
|
a6ef1f | 2000-03-28 | Johan Sundström | | in the administration interface and logs.
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | .BROXEN_CONFIGDIRB.: Same as .B--config-dir=... B.
.BROXEN_PID_FILEB.: Same as .B--pid-file=... B.
.BROXEN_LANGB.: The default language for all language
|
7de518 | 1998-11-22 | Per Hedbor | | related tags. Defaults to 'en' for english.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
82f519 | 1997-03-02 | Per Hedbor | | EOF
tput 'rmso' 2>/dev/null
|
b1fca0 | 1996-11-12 | Per Hedbor | | exit 0
;;
*)
pass="$pass $1"
|
5e87b4 | 1997-04-09 | Henrik Grubbström (Grubba) | | ;;
|
b1fca0 | 1996-11-12 | Per Hedbor | | esac
shift
|
82f519 | 1997-03-02 | Per Hedbor | | done
}
parse_args $@
|
b1fca0 | 1996-11-12 | Per Hedbor | |
|
82f519 | 1997-03-02 | Per Hedbor | | if [ ! "X$ROXEN_ARGS" = "X" ]; then
|
14fd21 | 1998-11-28 | Henrik Grubbström (Grubba) | | if [ $verbose -gt 0 ]; then
|
67549e | 1999-09-05 | Per Hedbor | | echo "$pre Using $ROXEN_ARGS from ROXEN_ARGS."
|
14fd21 | 1998-11-28 | Henrik Grubbström (Grubba) | | else :; fi
|
82f519 | 1997-03-02 | Per Hedbor | | parse_args $ROXEN_ARGS
fi
|
d1ff62 | 1997-07-24 | Marcus Comstedt | | if [ ! "X$pass" = "X" ] ; then set -- $pass ;fi
|
b1fca0 | 1996-11-12 | Per Hedbor | |
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | ####### END ARGUMENT PARSING
####### BEGIN PIKE OPTIONS
# Roxen will create files as the initial user,
# which it expects to be able to read as the run-time user.
umask 022
|
258767 | 1999-04-24 | Martin Stjernholm | | if [ "x$PIKE_NO_DEFAULT_PATHS" = "x" ]; then
# Pike default Master-program
if [ "x$PIKE_MASTER" = "x" ]; then
if [ -d share/pike ]; then
# This is used with localinstall
DEFINES="$DEFINES -I$roxendir/share/pike/include"
PIKE_MODULE_PATH="$PIKE_MODULE_PATH:$roxendir/share/pike/modules"
fi
if [ -f lib/master.pike ]; then
DEFINES="$DEFINES -m$roxendir/lib/master.pike -I$roxendir/lib/include"
PIKE_MODULE_PATH="$PIKE_MODULE_PATH:$roxendir/lib/modules:$roxendir/share/modules"
elif [ -f lib/pike/master.pike ]; then
DEFINES="$DEFINES -m$roxendir/lib/pike/master.pike -I$roxendir/lib/pike/include"
PIKE_MODULE_PATH="$PIKE_MODULE_PATH:$roxendir/lib/pike/modules:$roxendir/share/pike/modules"
fi
export PIKE_MODULE_PATH
else
# This is useful when using several different Pikes.
# Specify include and module paths with
# PIKE_INCLUDE_PATH and PIKE_MODULE_PATH
# they are handled automatically by the master,
# so no need to do it here.
DEFINES="$DEFINES -m$PIKE_MASTER"
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | fi
fi
# Extra module-path
if [ -d etc/modules ]; then
DEFINES="$DEFINES -M$roxendir/etc/modules"
fi
# Extra include-path
if [ -d etc/include ]; then
DEFINES="$DEFINES -I$roxendir/etc/include"
fi
|
f29224 | 2000-03-24 | Henrik Grubbström (Grubba) | | if [ -d $LOCALDIR/include ]; then
DEFINES="$DEFINES -I$LOCALDIR/include"
|
77868d | 2000-03-13 | Per Hedbor | | fi
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | # Extra include-path (2)
if [ -d base_server ]; then
DEFINES="$DEFINES -I$roxendir/base_server"
fi
|
f29224 | 2000-03-24 | Henrik Grubbström (Grubba) | | if [ -d $LOCALDIR/base_server ]; then
DEFINES="$DEFINES -I$LOCALDIR/base_server -P$LOCALDIR/base_server"
|
77868d | 2000-03-13 | Per Hedbor | | fi
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | # Extra program-path
DEFINES="$DEFINES -P`pwd`"
# Support for adding local pike-modules
|
f29224 | 2000-03-24 | Henrik Grubbström (Grubba) | | if [ -d $LOCALDIR/etc/. ]; then
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | # Extra module-path
|
f29224 | 2000-03-24 | Henrik Grubbström (Grubba) | | if [ -d $LOCALDIR/etc/modules/. ]; then
DEFINES="$DEFINES -M$LOCALDIR/etc/modules"
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | fi
# Extra include-path
|
f29224 | 2000-03-24 | Henrik Grubbström (Grubba) | | if [ -d $LOCALDIR/etc/include ]; then
DEFINES="$DEFINES -I$LOCALDIR/etc/include"
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | fi
# Extra program-path
|
f29224 | 2000-03-24 | Henrik Grubbström (Grubba) | | DEFINES="$DEFINES -P$LOCALDIR/etc"
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | fi
# Extra kludge for HPUX
# HPUX doesn't like group 60001(nobody)
if uname | grep 'HP-UX' >/dev/null 2>&1; then
|
14fd21 | 1998-11-28 | Henrik Grubbström (Grubba) | | if [ $verbose -gt 0 ]; then
|
67549e | 1999-09-05 | Per Hedbor | | echo "$pre WARNING: Applying kludge for HPUX. (see base_server/privs.pike)"
|
14fd21 | 1998-11-28 | Henrik Grubbström (Grubba) | | else :; fi
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | DEFINES="$DEFINES -DHPUX_KLUDGE"
fi
|
0272d3 | 1999-11-03 | Henrik Grubbström (Grubba) | |
case "x$debug" in
"x")
|
d12de0 | 1999-12-21 | Per Hedbor | | DEBUG="-DMODULE_DEBUG "
|
bcdd9d | 1999-12-13 | Per Hedbor | | ARGS="$ARGS -w"
|
0272d3 | 1999-11-03 | Henrik Grubbström (Grubba) | | ;;
"x-1")
DEBUG=""
;;
"x1")
|
9e8fac | 2000-02-08 | Martin Stjernholm | | DEBUG="-DDEBUG -DMODULE_DEBUG"
|
0272d3 | 1999-11-03 | Henrik Grubbström (Grubba) | | ARGS="$ARGS -w"
;;
esac
DEFINES="$DEBUG $DEFINES"
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | ####### END PIKE OPTIONS
|
38e43b | 1998-09-12 | Henrik Grubbström (Grubba) | |
#
# Some useful functions
#
rotate () {
b=5;
for a in 4 3 2 1 ; do mv -f $1.$a $1.$b 2> /dev/null; b=$a; done
}
start_roxen() {
|
77868d | 2000-03-13 | Per Hedbor | | if [ x$remove_dumped = x1 ] ; then
remove_old_dot_o_files "user request"
fi
|
e6a171 | 2000-02-02 | Per Hedbor | | if [ "x$DIR" != "x../configurations/" ] ; then
|
754121 | 1999-10-08 | Per Hedbor | | args="$DEFINES $ARGS $program --config-dir=$DIR $pass"
|
b796b5 | 1998-11-18 | Per Hedbor | | else
|
754121 | 1999-10-08 | Per Hedbor | | args="$DEFINES $ARGS $program $pass"
|
b796b5 | 1998-11-18 | Per Hedbor | | fi
|
e6a171 | 2000-02-02 | Per Hedbor | | if [ x$cd_to != x ] ; then
|
b796b5 | 1998-11-18 | Per Hedbor | | cd $cd_to
fi
|
38e43b | 1998-09-12 | Henrik Grubbström (Grubba) | | if [ "x$gdb" = "xno" ]; then
|
14fd21 | 1998-11-28 | Henrik Grubbström (Grubba) | | if [ $verbose -gt 0 ]; then
|
0dbd69 | 2000-02-17 | Martin Stjernholm | | if [ $verbose -gt 1 -o -z "$once" ] ; then
|
924570 | 2000-02-16 | Per Hedbor | | echo "$pre" "Executing $pike $args $@"|sed -e "s!`pwd`!.!g"
else
echo "$pre" "Using '$pike'"|sed -e "s!`pwd`!.!g"
fi
fi
|
024c7e | 2000-03-31 | Martin Nilsson | | args="-DSERIOUS $args"
|
38e43b | 1998-09-12 | Henrik Grubbström (Grubba) | | $pike $args $@
else
|
05783b | 1999-09-11 | Martin Stjernholm | | echo "$pre" Executing gdb $pike $args $@
|
3597b1 | 2000-02-15 | Martin Nilsson | | args="-DSERIOUS $args"
|
38e43b | 1998-09-12 | Henrik Grubbström (Grubba) | | echo >.gdbinit handle SIGPIPE nostop noprint pass
echo >>.gdbinit handle SIGUSR1 nostop noprint pass
echo >>.gdbinit handle SIGUSR2 nostop noprint pass
|
72a450 | 2000-03-10 | Martin Stjernholm | | echo >>.gdbinit handle SIGLWP nostop noprint pass
|
38e43b | 1998-09-12 | Henrik Grubbström (Grubba) | | echo >>.gdbinit run $args $@
gdb $pike
rm .gdbinit
fi
}
#
# Now do the stuff
#
|
221398 | 1999-09-05 | Per Hedbor | | PIKEVERSION=`$pike --version 2>&1`
|
e6a171 | 2000-02-02 | Per Hedbor | | if [ "$program" = "base_server/roxenloader.pike" ] ; then
|
49fff3 | 2000-01-27 | Henrik Grubbström (Grubba) | | if [ "`cat $old_roxen_defines 2>/dev/null`" != "$PIKEVERSION $DEFINES" ] ; then
|
7aad02 | 2000-02-14 | Martin Stjernholm | | remove_old_dot_o_files "defines or pike version changed"
|
754121 | 1999-10-08 | Per Hedbor | | fi
|
49fff3 | 2000-01-27 | Henrik Grubbström (Grubba) | | echo "$PIKEVERSION $DEFINES" > $old_roxen_defines
|
754121 | 1999-10-08 | Per Hedbor | | fi
|
221398 | 1999-09-05 | Per Hedbor | |
|
a8135b | 1996-11-12 | Per Hedbor | | if [ -z "$once" ] ; then
|
14fd21 | 1998-11-28 | Henrik Grubbström (Grubba) | | if [ $verbose -gt 0 ]; then
|
e6a171 | 2000-02-02 | Per Hedbor | | echo "$pre" Starting the Roxen World Wide Web server.
|
14fd21 | 1998-11-28 | Henrik Grubbström (Grubba) | | else :; fi
./mkdir -p $LOGDIR/debug/
|
0a4af8 | 1998-11-28 | Per Hedbor | |
|
14fd21 | 1998-11-28 | Henrik Grubbström (Grubba) | | if [ $verbose -gt 0 ]; then
cat << oo
|
13c548 | 1998-07-02 | Henrik Grubbström (Grubba) | | Using configuration from $DIR, storing the debug log in $LOGDIR/debug/$FILES.1
|
a6ef1f | 2000-03-28 | Johan Sundström | | You can use the administration interface in the server to get debug info.
|
13c548 | 1998-07-02 | Henrik Grubbström (Grubba) | | oo
|
14fd21 | 1998-11-28 | Henrik Grubbström (Grubba) | | else :; fi
|
13c548 | 1998-07-02 | Henrik Grubbström (Grubba) | |
# Try to get rid of some fd's.
# Some /bin/sh's have problems detaching otherwise.
exec >/dev/null
exec </dev/null
|
49fff3 | 2000-01-27 | Henrik Grubbström (Grubba) | | if ((while : ; do
echo "$pre" "Server restart at `date`"
echo "$pre" "Debug log in $LOGDIR/debug/$FILES.1"
rotate $LOGDIR/debug/$FILES
start_roxen $extra_args 2>>$LOGDIR/debug/$FILES.1 1>&2
exitcode="$?"
if [ "$exitcode" -eq "0" ] ; then
# Clean shutdown.
echo "$pre" "Roxen shutdown."
exit 0
fi
if [ "$exitcode" -lt "0" ] ; then
# Signal death.
echo "$pre" "Roxen died of signal $exitcode. Restarting..."
else
echo "$pre" Roxen down. Restarting.
fi
done) & ) </dev/null >$LOGDIR/debug/start_$FILES.output 2>&1; then
:;
else
echo 'Failed to spawn subshell. -- Permission problem?' 1>&2
exit 1
fi
|
a8135b | 1996-11-12 | Per Hedbor | | else
|
1cee49 | 1999-12-13 | Per Hedbor | | start_roxen $extra_args 2>&1
|
a8135b | 1996-11-12 | Per Hedbor | | fi
|