b1fca0 | 1996-11-12 | Per Hedbor | | #!/bin/sh
|
fd1295 | 1997-09-07 | Henrik Grubbström (Grubba) | | #
|
27b3ee | 2002-06-05 | Martin Nilsson | | # $Id: start,v 1.196 2002/06/05 00:13:51 nilsson Exp $
|
39ed8c | 2000-08-31 | Fredrik Noring | |
### If --silent-start is given as the first argument,
### nothing will be printed to stdout by the script.
|
270fdc | 2000-12-30 | Per Hedbor | | if [ "x$1" = "x--silent-start" ] ; then
SILENT_START="y"
shift
|
39ed8c | 2000-08-31 | Fredrik Noring | | fi
|
67549e | 1999-09-05 | Per Hedbor | |
|
196c3f | 2000-11-16 | Per Hedbor | | check_owner() {
gargs=''
|
8cc180 | 2001-01-03 | Per Hedbor | | if [ -w / ] ; then
|
196c3f | 2000-11-16 | Per Hedbor | | # Shall we change uid/gid?
num=`grep --help 2>&1|grep gnu|wc -l`
num=`echo $num`
if [ x"$num" = x1 ] ; then
gargs='-a'
fi
ugid=`grep $gargs "='User'>" $DIR/Global_Variables 2>/dev/null\
| sed -e 's/.*<str>//' -e 's,</str>.*,,'`
if [ ! x$ugid = x ] ; then
dp "Doing uid change to $ugid"
oifs="$IFS";IFS=':';set $ugid;IFS="$oifs"
|
4fcfa3 | 2001-03-27 | Martin Stjernholm | | if [ ! "x$2" = x ]; then
ok=`ls -lgd . 2>/dev/null | grep $2 |wc -l`
ok=`echo $ok`
if [ "x$ok" = x1 ] ; then
dp "The server directory is already readable by group $2"
else
chgrp -R "$2" .
chmod -R g+r .
fi
fi
|
196c3f | 2000-11-16 | Per Hedbor | | change_owner $1 $2 $DIR $VARDIR $LOGDIR
fi
fi
}
|
a01fd9 | 2000-08-09 | Per Hedbor | | # Breaks on linux when using symlinks.
dn="`dirname $0`"
case "$dn" in
""|".")
;;
*)
|
270fdc | 2000-12-30 | Per Hedbor | | # dp is not used here since we cannot source bin/functions before we
# are in the correct directory, for quite obvious reasons...
|
4c638d | 2001-03-20 | Fredrik Noring | | if [ ! "$dn" = "`pwd`" ]
then
echo " : Changing current directory to '$dn' (now `pwd`)" >&2
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | cd "$dn"
|
4c638d | 2001-03-20 | Fredrik Noring | | echo " : Got new directory as `pwd`" >&2
fi
|
a01fd9 | 2000-08-09 | Per Hedbor | | ;;
esac
|
0a4af8 | 1998-11-28 | Per Hedbor | |
|
270fdc | 2000-12-30 | Per Hedbor | | . bin/functions
|
b1fca0 | 1996-11-12 | Per Hedbor | | # Can be set with '--config-dir=DIR'
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | DIR=../configurations
LOGDIR=../logs
|
b1fca0 | 1996-11-12 | Per Hedbor | | FILES="default"
|
3e7d3b | 1998-03-20 | Per Hedbor | | program=base_server/roxenloader.pike
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | VARDIR=../var
LOCALDIR=../local
|
d7d5dd | 2001-08-10 | Marcus Wellhardh | | SELF_TEST_DIR=etc/test
|
f29224 | 2000-03-24 | Henrik Grubbström (Grubba) | |
# Make LOCALDIR an absolute path
|
a7b8d7 | 2000-03-24 | Henrik Grubbström (Grubba) | | if test -d $LOCALDIR/.; then
|
21ae4e | 2001-10-19 | 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
|
ff3b9a | 2000-08-09 | Per Hedbor | | dp "Creating directory $VARDIR"
|
a0498a | 2002-06-03 | Per Hedbor | | ./bin/mkdir -p $VARDIR/ || exit 1
|
423fdd | 2000-04-01 | Henrik Grubbström (Grubba) | | fi
|
348d6c | 2000-08-30 | Martin Stjernholm | |
|
b654ea | 2000-10-02 | Jonas Wallden | | pcdir="$VARDIR/`roxen_version`/precompiled/`uname -m | tr ' ' '_' `.`uname -r`"
|
9b1a12 | 2000-02-04 | Per Hedbor | | old_roxen_defines="$pcdir/old_roxen_defines"
|
a0498a | 2002-06-03 | Per Hedbor | | ./bin/mkdir -p "$pcdir" || exit 1
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | chmod 1777 "$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) | |
|
149015 | 2001-08-06 | Martin Stjernholm | | # No debug by default.
debug=-1
|
d25ab7 | 2000-03-30 | Leif Stensson | | # Locate Pike binary.
|
270fdc | 2000-12-30 | Per Hedbor | | find_pike
|
d25ab7 | 2000-03-30 | Leif Stensson | |
|
270fdc | 2000-12-30 | Per Hedbor | | # Source environment
setup_environment
|
d25ab7 | 2000-03-30 | Leif Stensson | |
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | ####### BEGIN ARGUMENT PARSING
|
b1fca0 | 1996-11-12 | Per Hedbor | |
|
2b19eb | 1999-08-20 | Per Hedbor | |
|
491abc | 2000-08-17 | Per Hedbor | | DEFINES="$DEFINES -DRAM_CACHE"
|
2b19eb | 1999-08-20 | Per Hedbor | |
|
e6e4f9 | 2002-04-02 | Henrik Grubbström (Grubba) | | # Thread enabling.
# FIXME: Ought to use case...esac.
|
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
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | # FIXME: What about Solaris 10+ (SunOS 5.10+)?
|
ff3b9a | 2000-08-09 | Per Hedbor | | # if [ $verbose -gt 0 ] ; then
# dp "Solaris 2.5 or later detected. Using threads by default."
# fi
|
72a450 | 2000-03-10 | Martin Stjernholm | | DEFINES="$DEFINES -DENABLE_THREADS"
|
c90cc9 | 1999-04-22 | Per Hedbor | | fi
fi
|
69c8b4 | 2002-05-18 | Jonas Wallden | | # Darwin 1.4/5.x or later (Mac OS X 10.1 or newer) also uses threads.
|
bfdb6e | 2001-09-19 | Jonas Wallden | | if uname | grep 'Darwin' >/dev/null 2>&1; then
if uname -r | grep '^1\.[4-9]' >/dev/null 2>&1; then
DEFINES="$DEFINES -DENABLE_THREADS"
|
69c8b4 | 2002-05-18 | Jonas Wallden | | elif uname -r | grep '^[5-9]' >/dev/null 2>&1; then
DEFINES="$DEFINES -DENABLE_THREADS"
|
bfdb6e | 2001-09-19 | Jonas Wallden | | fi
fi
|
e6e4f9 | 2002-04-02 | Henrik Grubbström (Grubba) | | # Also enabled on Linux.
if uname | grep 'Linux' >/dev/null 2>&1; then
DEFINES="$DEFINES -DENABLE_THREADS"
fi
|
c90cc9 | 1999-04-22 | Per Hedbor | |
|
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 () {
|
af3dd8 | 2001-01-01 | Martin Nilsson | | dp "Removing old precompiled files ($1)"
|
74e390 | 2000-12-30 | Per Hedbor | | # This really cannot be done from here anymore -- pass on an option
# to roxenloader instead.
pass="$pass --remove-dumped"
|
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=""
|
4ba845 | 2001-01-31 | Per Hedbor | | setup_for_tests() {
|
cfdc33 | 2001-07-02 | Martin Nilsson | | # Kill roxen mysql if it's running...
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | if [ -f "$VARDIR/test_config/_mysql/mysql_pid" ] ; then
kill `cat "$VARDIR/test_config/_mysql/mysql_pid"`
|
cfdc33 | 2001-07-02 | Martin Nilsson | | fi
|
b5b125 | 2001-06-30 | Martin Stjernholm | | self_test=y
|
d7d5dd | 2001-08-10 | Marcus Wellhardh | | DEFINES="-DRUN_SELF_TEST -DSELF_TEST_DIR=\"$SELF_TEST_DIR\" $DEFINES"
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | rm -rf "$VARDIR/test_config"*
DIR="$VARDIR/test_config"
if [ -f "$SELF_TEST_DIR/scripts/setup.pike" ] ; then
$PIKE "$SELF_TEST_DIR/scripts/setup.pike" "$SELF_TEST_DIR" "$VARDIR"
|
d7d5dd | 2001-08-10 | Marcus Wellhardh | | fi
|
f7e74e | 2001-09-20 | Martin Nilsson | | once=${once:-1}
debug=1
|
4ba845 | 2001-01-31 | Per Hedbor | | remove_dumped=1
}
|
82f519 | 1997-03-02 | Per Hedbor | | parse_args() {
while [ ! c"$1" = "c" ] ; do
|
00b8b0 | 2001-02-02 | Fredrik Noring | | 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 | | ;;
|
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=//'`
;;
|
567dac | 2001-03-23 | Per Hedbor | | --debug-log=*)
DEBUGLOG=`echo $1 | sed -e's/--debug-log=//'`
;;
|
b1fca0 | 1996-11-12 | Per Hedbor | | --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=*)
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | pidfile=`echo $1 | sed -e 's/--pid-file=//'`
|
7c6da6 | 1998-11-01 | Henrik Grubbström (Grubba) | | ;;
|
cdd991 | 2000-10-30 | Per Hedbor | | '--with-security'|'--enable-security')
DEFINES="$DEFINES -DSECURITY"
;;
|
3f240b | 2001-09-04 | Honza Petrous | | '--with-snmp-agent'|'--enable-snmp-agent')
DEFINES="$DEFINES -DSNMP_AGENT"
;;
|
cdd991 | 2000-10-30 | Per Hedbor | |
|
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
;;
|
149015 | 2001-08-06 | Martin Stjernholm | | '--module-debug'|'--with-module-debug'|'--enable-module-debug')
debug=0
;;
|
8a788c | 1998-07-22 | David Hedbor | | '--fd-debug'|'--with-fd-debug'|'--enable-fd-debug')
|
cc4fdd | 1998-03-26 | Per Hedbor | | DEFINES="-DFD_DEBUG $DEFINES"
;;
|
5655dc | 2001-06-06 | Per Hedbor | | '--strip-backslash'|'--without-backslash'|'--strip-back-slash')
DEFINES="-DSTRIP_BSLASH $DEFINES"
;;
|
9a0545 | 2001-10-04 | Per Hedbor | | '--offline')
DEFINES="-DNO_DNS -DOFFLINE $DEFINES"
;;
|
491abc | 2000-08-17 | Per Hedbor | | '--without-ram-cache'|'--disable-ram-cache')
DEFINES="`echo $DEFINES | sed -e 's/-DRAM_CACHE//g'`"
;;
'--without-ram-cache-stat'|'--disable-ram-cache-stat')
DEFINES="`-DRAM_CACHE_ASUME_STATIC_CONTENT`"
;;
|
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 | | ;;
|
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"
;;
|
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 | | ;;
|
fb4903 | 2001-05-16 | Per Hedbor | |
|
a8135b | 1996-11-12 | Per Hedbor | | '--once')
|
42581f | 2001-08-13 | Martin Stjernholm | | once=${once:-1}
|
149015 | 2001-08-06 | Martin Stjernholm | | debug=0
|
a8135b | 1996-11-12 | Per Hedbor | | ;;
|
cbced9 | 1998-11-06 | Marcus Comstedt | | # Misspelling --once might give undesirable results, so let's accept
# some "creative" spellings... :-)
|
fb4903 | 2001-05-16 | Per Hedbor | | '--onve'|'--onec'|'--onev'|'--ocne')
|
42581f | 2001-08-13 | Martin Stjernholm | | once=${once:-1}
|
149015 | 2001-08-06 | Martin Stjernholm | | debug=0
|
cbced9 | 1998-11-06 | Marcus Comstedt | | ;;
|
b80b4c | 2001-07-09 | Martin Nilsson | | '--keep-mysql')
keep_mysql=1
;;
|
c6420b | 1998-06-02 | Henrik Grubbström (Grubba) | | '--gdb')
gdb=gdb
|
42581f | 2001-08-13 | Martin Stjernholm | | once=2
|
149015 | 2001-08-06 | Martin Stjernholm | | debug=0
|
c6420b | 1998-06-02 | Henrik Grubbström (Grubba) | | ;;
|
3e7d3b | 1998-03-20 | Per Hedbor | | '--program')
program="$2"
|
42581f | 2001-08-13 | Martin Stjernholm | | once=2
|
409e9b | 2001-02-01 | Per Hedbor | | passhelp=1
|
3e7d3b | 1998-03-20 | Per Hedbor | | shift
|
8941f6 | 2001-10-15 | Henrik Grubbström (Grubba) | | shift
# Pass any remaining arguments along to the program.
while [ ! c"$1" = "c" ] ; do
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | pass="$pass '`echo \"$1\" | sed -e \"s/'/'\\\"'\\\"'/g\"`'"
|
8941f6 | 2001-10-15 | Henrik Grubbström (Grubba) | | shift
done
break
|
3e7d3b | 1998-03-20 | Per Hedbor | | ;;
|
b796b5 | 1998-11-18 | Per Hedbor | | '--cd')
cd_to="$2"
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | # Use the absolute path...
roxendir="`pwd`"
|
42581f | 2001-08-13 | Martin Stjernholm | | once=${once:-1}
|
b796b5 | 1998-11-18 | Per Hedbor | | shift
;;
|
2e1f94 | 2001-06-26 | Martin Stjernholm | | --debug-without=*|-r*|-d*|-t*|-l*|-w*|-a*|-p*|--*-debug*)
|
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')
|
409e9b | 2001-02-01 | Per Hedbor | | if [ "x$passhelp" = "x1" ] ; then
pass="$pass --version"
else
|
6a5775 | 1999-08-06 | Henrik Grubbström (Grubba) | | if [ -f base_server/roxen.pike ]; then
|
fd8720 | 2000-09-01 | Martin Nilsson | | echo "Roxen WebServer `roxen_version`"
|
6a5775 | 1999-08-06 | Henrik Grubbström (Grubba) | | exit 0
else
echo 'base_server/roxen.pike not found!'
exit 1
fi
|
409e9b | 2001-02-01 | Per Hedbor | | fi
|
b1fca0 | 1996-11-12 | Per Hedbor | | ;;
|
d7d5dd | 2001-08-10 | Marcus Wellhardh | | --self-test-dir=*)
SELF_TEST_DIR=`echo $1 | sed -e's/--self-test-dir=//'`
;;
|
a0129c | 2000-11-11 | Martin Nilsson | | '--self-test')
|
4ba845 | 2001-01-31 | Per Hedbor | | setup_for_tests
;;
'--self-test-quiet')
debug=-1
SILENT_START=y
do_pipe="| grep ' |'"
setup_for_tests
;;
'--self-test-verbose')
pass="$pass --tests-verbose=1"
setup_for_tests
|
a0129c | 2000-11-11 | Martin Nilsson | | ;;
|
b1fca0 | 1996-11-12 | Per Hedbor | | '--help'|'-?')
|
409e9b | 2001-02-01 | Per Hedbor | | if [ "x$passhelp" = "x1" ] ; then
pass="$pass --help"
else
|
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
|
fd8720 | 2000-09-01 | Martin Nilsson | | .BThis command will start the Roxen WebServerB..
|
8edfa3 | 1998-08-20 | Per Hedbor | |
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.
|
9a0545 | 2001-10-04 | Per Hedbor | | .B--offlineB.: Indicate that there is no network
connection available. Disables DNS and some
other similar things.
|
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.
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | Defaults to .B../configurationsB..
|
567dac | 2001-03-23 | Per Hedbor | | .B--debug-log=FILEB.: Use an alternate debuglog file.
Defaults to .B../logs/debug/B.configdirname.B.1B..
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | .B--pid-file=FILEB.: Store the roxen and startscript pids in this
file. Defaults to .B../configurations/_roxen_pidB..
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
39ed8c | 2000-08-31 | Fredrik Noring | | .B--silent-startB.: Inhibits output to stdout. If used,
this argument must be the first one.
|
5655dc | 2001-06-06 | Per Hedbor | | .B--strip-backslashB.: Replace all \\ characters in URIs with /
|
30393a | 2002-04-16 | Martin Stjernholm | | .B--without-ram-cacheB.: Do not use a protocol level RAM cache to speed
|
491abc | 2000-08-17 | Per Hedbor | | things up. Saves RAM at the cost of speed.
|
30393a | 2002-04-16 | Martin Stjernholm | | .B--without-ram-cache-statB.: Disable the stat that is usually done
for files in the protocol cache to ensure that
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | they are not changed before they are sent.
|
491abc | 2000-08-17 | Per Hedbor | | Improves performance at the cost of constant
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | aggravation if the site is edited. Useful for
|
491abc | 2000-08-17 | Per Hedbor | | truly static sites.
|
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 | |
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | .B--self-testB.: Runs a testsuite.
.B--self-test-verboseB.: Runs a testsuite, report all tests.
.B--self-test-quietB.: Runs a testsuite, only report errors.
|
d7d5dd | 2001-08-10 | Marcus Wellhardh | | .B--self-test-dir=DIRB.: Use this self test directory instead of
the default .Betc/testB. directory.
|
a0129c | 2000-11-11 | Martin Nilsson | |
|
c083c2 | 1998-09-19 | Henrik Grubbström (Grubba) | | .B--onceB.: Run the server only once, in the foreground.
|
149015 | 2001-08-06 | Martin Stjernholm | | This is very useful when debugging. Implies
--module-debug.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
adea56 | 2001-11-21 | Martin Stjernholm | | .B--keep-mysqlB.: Do not shut down MySQL process when exiting
|
b80b4c | 2001-07-09 | Martin Nilsson | | the start script. Useful during development
or any other scenario where the start script
is frequently terminated.
|
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 | |
|
149015 | 2001-08-06 | Martin Stjernholm | | .B--without-debugB.: Disable all debug. This is the default.
.B--module-debugB.: Enable more internal debug checks to
simplify debugging of Roxen modules.
|
e6a171 | 2000-02-02 | Per Hedbor | |
|
149015 | 2001-08-06 | Martin Stjernholm | | .B--fd-debugB.: Enable FD debug.
|
8edfa3 | 1998-08-20 | Per Hedbor | |
|
149015 | 2001-08-06 | Martin Stjernholm | | .B--dump-debugB.: Enable dump debug.
|
67549e | 1999-09-05 | Per Hedbor | |
|
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.
|
3f240b | 2001-09-04 | Honza Petrous | | .B--with-snmp-agentB.: Enable internal SNMP agent code.
|
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
|
e2a69f | 2001-02-26 | Martin Stjernholm | | with debug (i.e. with --rtl-debug to
configure).
|
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 | |
|
337c78 | 2001-05-17 | Martin Stjernholm | | .B-pB.: Turn on Pike profiling.
|
e6a171 | 2000-02-02 | Per Hedbor | | .B-t<level>B.: Turn on more Pike tracing. This only
|
e2a69f | 2001-02-26 | Martin Stjernholm | | works if Pike is compiled with debug
(i.e. with --rtl-debug to configure).
.B-a<level>B.: Turn on Pike assembler debug. This only
works if Pike is compiled with debug
(i.e. with --rtl-debug to configure).
|
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
|
409e9b | 2001-02-01 | Per Hedbor | | fi
|
b1fca0 | 1996-11-12 | Per Hedbor | | ;;
*)
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | pass="$pass '`echo \"$1\" | sed -e \"s/'/'\\\"'\\\"'/g\"`'"
|
5e87b4 | 1997-04-09 | Henrik Grubbström (Grubba) | | ;;
|
b1fca0 | 1996-11-12 | Per Hedbor | | esac
shift
|
82f519 | 1997-03-02 | Per Hedbor | | done
}
|
ff3b9a | 2000-08-09 | Per Hedbor | | if [ ! "X$ROXEN_ARGS" = "X" ]; then
parse_args $ROXEN_ARGS
fi
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | parse_args "$@"
|
b1fca0 | 1996-11-12 | Per Hedbor | |
|
ff3b9a | 2000-08-09 | Per Hedbor | | # The work has already been done above, but the debug printout is better
# to have _after_ parse_args (consider --help and --version)
|
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
|
ff3b9a | 2000-08-09 | Per Hedbor | | dp "Used $ROXEN_ARGS from ROXEN_ARGS."
|
14fd21 | 1998-11-28 | Henrik Grubbström (Grubba) | | else :; fi
|
82f519 | 1997-03-02 | Per Hedbor | | 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
|
fd8720 | 2000-09-01 | Martin Nilsson | | # Roxen WebServer will create files as the initial user,
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | # 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 [ -f lib/master.pike ]; then
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | DEFINES="$DEFINES \"-m$roxendir/lib/master.pike\""
|
258767 | 1999-04-24 | Martin Stjernholm | | elif [ -f lib/pike/master.pike ]; then
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | DEFINES="$DEFINES \"-m$roxendir/lib/pike/master.pike\""
|
258767 | 1999-04-24 | Martin Stjernholm | | fi
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.
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | DEFINES="$DEFINES \"-m$PIKE_MASTER\""
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | fi
fi
# Extra module-path
|
27b3ee | 2002-06-05 | Martin Nilsson | | DEFINES="$DEFINES \"-M$roxendir/pike_modules\""
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | |
# Extra include-path
|
27b3ee | 2002-06-05 | Martin Nilsson | | DEFINES="$DEFINES \"-I$roxendir/etc/include\""
|
77868d | 2000-03-13 | Per Hedbor | |
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | # Extra program-path
|
27b3ee | 2002-06-05 | Martin Nilsson | | DEFINES="$DEFINES \"-Pbase_server\" \"-P`pwd`\""
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | |
# Support for adding local pike-modules
|
27b3ee | 2002-06-05 | Martin Nilsson | | # Extra module-path
if [ -d "$LOCALDIR/pike_modules/." ]; then
DEFINES="$DEFINES \"-M$LOCALDIR/pike_modules\""
fi
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | |
|
27b3ee | 2002-06-05 | Martin Nilsson | | # Extra include-path
if [ -d "$LOCALDIR/include/." ]; then
DEFINES="$DEFINES \"-I$LOCALDIR/include\""
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | fi
|
27b3ee | 2002-06-05 | Martin Nilsson | |
|
b1e9fe | 1998-11-28 | Henrik Grubbström (Grubba) | | # 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
|
8cc180 | 2001-01-03 | Per Hedbor | | dp "WARNING: Applying kludge for HPUX. (see base_server/roxen.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
|
149015 | 2001-08-06 | Martin Stjernholm | | "x"|"x0")
|
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
#
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | cleanup_pid_file() {
[ -z "$pidfile" ] || rm $pidfile
}
|
0259c4 | 2000-08-31 | Martin Stjernholm | | signal_exit() {
|
42581f | 2001-08-13 | Martin Stjernholm | | dp "Start script terminating."
|
990757 | 2001-06-28 | Martin Stjernholm | | trap "" 2 15
|
0259c4 | 2000-08-31 | Martin Stjernholm | | if [ "x$ROXEN_PID" != "x" ]; then
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | kill $ROXEN_PID 2>/dev/null && wait $ROXEN_PID 2>/dev/null
dp "Roxen WebServer shutdown."
|
0259c4 | 2000-08-31 | Martin Stjernholm | | fi
|
b80b4c | 2001-07-09 | Martin Nilsson | | if [ "x$keep_mysql" = "x" ] ; then
|
63deb3 | 2001-06-27 | Per Hedbor | | if [ -f $DIR/_mysql/mysql_pid ] ; then
|
42581f | 2001-08-13 | Martin Stjernholm | | dp "Shutting down mysql."
|
b80b4c | 2001-07-09 | Martin Nilsson | | kill `cat $DIR/_mysql/mysql_pid` 2>/dev/null
sleep 2
if [ -f $DIR/_mysql/mysql_pid ] ; then
kill -9 `cat $DIR/_mysql/mysql_pid` 2>/dev/null
fi
rm -f $DIR/_mysql/mysql_pid 2>/dev/null
|
63deb3 | 2001-06-27 | Per Hedbor | | fi
fi
|
248df9 | 2001-07-02 | Martin Stjernholm | | dp "Start script terminated."
|
0259c4 | 2000-08-31 | Martin Stjernholm | | exit 0
}
|
e8a901 | 2001-01-31 | Per Hedbor | | exit_fail() {
exitcode=1
}
|
88d43a | 2001-11-21 | Martin Stjernholm | | # This is a trick to get $ROXEN_PID and arguments containing spaces
# correct at the same time.
fork_roxen() {
"$@" &
ROXEN_PID=$!
}
|
38e43b | 1998-09-12 | Henrik Grubbström (Grubba) | | start_roxen() {
|
196c3f | 2000-11-16 | Per Hedbor | | check_owner
|
270fdc | 2000-12-30 | Per Hedbor | | raise_limit
|
001f83 | 2000-11-20 | Per Hedbor | |
|
77868d | 2000-03-13 | Per Hedbor | | if [ x$remove_dumped = x1 ] ; then
remove_old_dot_o_files "user request"
fi
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | if [ "x$DIR" != "x../configurations" ] ; then
args="$DEFINES $ARGS $program --config-dir='`echo \"$DIR\" | sed -e \"s/'/'\\\"'\\\"'/g\"`' $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
|
941fc7 | 2001-06-20 | Fredrik Noring | | if [ x"$cd_to" != x ] ; then
cd "$cd_to"
|
b796b5 | 1998-11-18 | Per Hedbor | | 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
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | dp "Executing $pike $args"|sed -e "s!`pwd`!.!g"
|
924570 | 2000-02-16 | Per Hedbor | | else
|
ad8dc1 | 2000-09-01 | Per Hedbor | | dp "Using the '$pike' pike binary"|sed -e "s!`pwd`!.!g"
|
924570 | 2000-02-16 | Per Hedbor | | fi
fi
|
0259c4 | 2000-08-31 | Martin Stjernholm | |
if [ "x$once" = "x" ]; then
|
88d43a | 2001-11-21 | Martin Stjernholm | | eval "fork_roxen \"$pike\" $args 2>>\"${DEBUGLOG}.1\" 1>&2"
|
fd8720 | 2000-09-01 | Martin Nilsson | | dp "Roxen WebServer server pid $ROXEN_PID."
|
42581f | 2001-08-13 | Martin Stjernholm | | wait $ROXEN_PID 2>/dev/null 1>&2
|
0259c4 | 2000-08-31 | Martin Stjernholm | | exitcode="$?"
ROXEN_PID=""
else
|
4ba845 | 2001-01-31 | Per Hedbor | | if [ "x$do_pipe" = "x" ] ; then
|
42581f | 2001-08-13 | Martin Stjernholm | | if [ "x$once" = "x1" ]; then
|
88d43a | 2001-11-21 | Martin Stjernholm | | eval "fork_roxen \"$pike\" $args 2>&1"
|
42581f | 2001-08-13 | Martin Stjernholm | | wait $ROXEN_PID 2>/dev/null 1>&2
exitcode="$?"
ROXEN_PID=""
else
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | eval "\"$pike\" $args" 2>&1
|
42581f | 2001-08-13 | Martin Stjernholm | | exitcode="$?"
fi
|
4ba845 | 2001-01-31 | Per Hedbor | | else
|
e8a901 | 2001-01-31 | Per Hedbor | | trap exit_fail 1
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | eval "(eval \"\\\"$pike\\\" $args\" || kill -1 $$) 2>&1 $do_pipe"
|
e8a901 | 2001-01-31 | Per Hedbor | | exit $exitcode
|
4ba845 | 2001-01-31 | Per Hedbor | | fi
|
0259c4 | 2000-08-31 | Martin Stjernholm | | fi
|
38e43b | 1998-09-12 | Henrik Grubbström (Grubba) | | else
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
|
1ccca7 | 2001-08-14 | Stefan Wallström | | if uname | grep 'Linux' >/dev/null 2>&1; then
echo >>.gdbinit handle SIG38 nostop noprint pass
echo >>.gdbinit handle SIG39 nostop noprint pass
fi
|
348d6c | 2000-08-30 | Martin Stjernholm | | firstline=`head -1 "$pike" 2>/dev/null`
if expr "x$firstline" : 'x#! */.*' >/dev/null; then
|
0259c4 | 2000-08-31 | Martin Stjernholm | | # Looks like a script. gdb will not grok it, so we try passing
|
348d6c | 2000-08-30 | Martin Stjernholm | | # --gdb to it instead (which works in the special case of the
|
0259c4 | 2000-08-31 | Martin Stjernholm | | # bin/pike script that is built by the top level Makefile in the
|
348d6c | 2000-08-30 | Martin Stjernholm | | # Pike source tree).
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | dp "Executing $pike --gdb $args"
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | eval "\"$pike\" --gdb $args"
|
348d6c | 2000-08-30 | Martin Stjernholm | | else
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | dp "Executing gdb $pike $args"
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | echo >>.gdbinit "run $args"
gdb "$pike"
|
348d6c | 2000-08-30 | Martin Stjernholm | | fi
|
38e43b | 1998-09-12 | Henrik Grubbström (Grubba) | | rm .gdbinit
fi
|
63deb3 | 2001-06-27 | Per Hedbor | | if [ x$once = x1 ] ; then
signal_exit
fi
|
38e43b | 1998-09-12 | Henrik Grubbström (Grubba) | | }
|
0259c4 | 2000-08-31 | Martin Stjernholm | |
|
38e43b | 1998-09-12 | Henrik Grubbström (Grubba) | | #
# Now do the stuff
#
|
a3a0ec | 2001-03-17 | Martin Stjernholm | |
trap signal_exit 2 15
trap "" 1
if [ -z "$once" ]; then
# Fix the pid file. We don't do this if once is set, since that
# often signifies that it's not the real server starting up, but
# instead some other process, e.g. one given with --program.
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | [ -z "$pidfile" ] && pidfile="${ROXEN_PID_FILE:-$DIR/_roxen_pid}"
pass="$pass --pid-file='`echo \"$pidfile\" | sed -e \"s/'/'\\\"'\\\"'/g\"`'"
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | # Avoid duplicate start scripts if we got a pid file.
mypid=$$
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | test -f "$pidfile" && {
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | if read roxenpid && read scriptpid; then
if kill -0 $scriptpid 2>/dev/null; then
dp "According to the pid file $pidfile,"
dp "there is already a start script running with pid $scriptpid. Specify "
dp "another pid file with --pid-file if this is a different server."
dp "Server not started."
:
elif kill -0 $roxenpid 2>/dev/null; then
dp "According to the pid file $pidfile,"
dp "there is already a server running with pid $roxenpid, but its start "
dp "script seems to have died. You should shut it down and restart "
dp "it, since it won't restart automatically. Server not started."
:
else false; fi
else false; fi
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | } < "$pidfile" && exit 1
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | # Minor race here.
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | { echo "x" && echo $mypid; } > "$pidfile"
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | trap cleanup_pid_file 0
fi
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | PIKEVERSION="`\"$pike\" --version 2>&1|head -1`"
LS="`ls -lL \"$pike\" 2>/dev/null`"
|
27b3ee | 2002-06-05 | Martin Nilsson | | LS="$LS `find pike_modules -ls 2>/dev/null`"
|
dec2ed | 2001-01-19 | Per Hedbor | | LS="$LS `find base_server -ls 2>/dev/null`"
|
221398 | 1999-09-05 | Per Hedbor | |
|
688d03 | 2000-09-25 | Per Hedbor | | VERSION_DATA="$PIKEVERSION $DEFINES $LS"
|
221398 | 1999-09-05 | Per Hedbor | |
|
e6a171 | 2000-02-02 | Per Hedbor | | if [ "$program" = "base_server/roxenloader.pike" ] ; then
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | if [ "`cat \"$old_roxen_defines\" 2>/dev/null`" != "$VERSION_DATA" ] ; then
|
7aad02 | 2000-02-14 | Martin Stjernholm | | remove_old_dot_o_files "defines or pike version changed"
|
754121 | 1999-10-08 | Per Hedbor | | fi
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | echo "$VERSION_DATA" > "$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
|
fd8720 | 2000-09-01 | Martin Nilsson | | dp "Starting the Roxen WebServer."
|
14fd21 | 1998-11-28 | Henrik Grubbström (Grubba) | | else :; fi
|
567dac | 2001-03-23 | Per Hedbor | | if [ "x$DEBUGLOG" = "x" ] ; then
DEBUGDIR="$LOGDIR/debug"
DEBUGLOG="$DEBUGDIR/$FILES"
else
DEBUGDIR="`dirname "$DEBUGLOG"`"
fi
|
6466f1 | 2001-03-24 | Per Hedbor | | # This duplicate of the logdir creation code is needed, check the
# redirect below
if [ ! -d "$DEBUGDIR" ] ; then
|
a0498a | 2002-06-03 | Per Hedbor | | if ./bin/mkdir -p "$DEBUGDIR" 2>/dev/null; then :; else
|
6466f1 | 2001-03-24 | Per Hedbor | | dp "Failed to create log directory $DEBUGDIR."
exit 1
fi
fi
|
14fd21 | 1998-11-28 | Henrik Grubbström (Grubba) | | if [ $verbose -gt 0 ]; then
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | dp "Using configuration from $DIR"
|
567dac | 2001-03-23 | Per Hedbor | | dp "Storing the debug log in ${DEBUGLOG}.1"
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | dp "You can use the administration interface in the server to see debug info."
|
14fd21 | 1998-11-28 | Henrik Grubbström (Grubba) | | else :; fi
|
13c548 | 1998-07-02 | Henrik Grubbström (Grubba) | |
|
0259c4 | 2000-08-31 | Martin Stjernholm | | if (
(
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | # Minor race here wrt pid file cleanup.
|
0259c4 | 2000-08-31 | Martin Stjernholm | | exec 3>&-
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | trap signal_exit 2 15
trap "" 1
trap cleanup_pid_file 0
|
0259c4 | 2000-08-31 | Martin Stjernholm | |
while : ; do
|
567dac | 2001-03-23 | Per Hedbor | | if test -d "$DEBUGDIR/."; then :; else
|
0259c4 | 2000-08-31 | Martin Stjernholm | | # Avoid infinite loop if the debug directory is deleted.
# Thanks to Emils Klotins <emils@dot.lv> for reporting it.
|
a0498a | 2002-06-03 | Per Hedbor | | if ./bin/mkdir -p "$DEBUGDIR" 2>/dev/null; then :; else
|
567dac | 2001-03-23 | Per Hedbor | | dp "Failed to create log directory $DEBUGDIR."
|
0259c4 | 2000-08-31 | Martin Stjernholm | | exit 1
fi
|
12017a | 2000-06-05 | Emils Klotins | | fi
|
49fff3 | 2000-01-27 | Henrik Grubbström (Grubba) | |
|
0259c4 | 2000-08-31 | Martin Stjernholm | | dp "Server start at `date`"
|
567dac | 2001-03-23 | Per Hedbor | | dp "Debug log in ${DEBUGLOG}.1"
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | rotate "$DEBUGLOG"
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | start_roxen
|
49fff3 | 2000-01-27 | Henrik Grubbström (Grubba) | |
|
0259c4 | 2000-08-31 | Martin Stjernholm | | if [ "$exitcode" -eq "0" ] ; then
# Clean shutdown.
|
fd8720 | 2000-09-01 | Martin Nilsson | | dp "Roxen WebServer shutdown."
|
b1886b | 2001-11-09 | Henrik Grubbström (Grubba) | | signal_exit
# Note reached, but...
|
0259c4 | 2000-08-31 | Martin Stjernholm | | exit 0
fi
if [ "$exitcode" -lt "0" ] ; then
# Signal death.
|
d97cca | 2001-11-15 | Henrik Grubbström (Grubba) | | dp "Roxen WebServer died of signal $exitcode."
|
0259c4 | 2000-08-31 | Martin Stjernholm | | else
|
00b8b0 | 2001-02-02 | Fredrik Noring | | case "$exitcode" in
100)
dp "Changing Roxen WebServer version. Restarting."
|
8e9f18 | 2002-01-03 | Henrik Grubbström (Grubba) | | # We need to clean up the pid file, since we're mentioned in it...
cleanup_pid_file
|
00b8b0 | 2001-02-02 | Fredrik Noring | | cd .. && exec ./start "$@"
dp 'Failed to spawn start script. -- Permission problem?'
exit 1
;;
*)
|
d97cca | 2001-11-15 | Henrik Grubbström (Grubba) | | dp "Roxen WebServer down with code $exitcode."
|
00b8b0 | 2001-02-02 | Fredrik Noring | | ;;
esac
|
0259c4 | 2000-08-31 | Martin Stjernholm | | fi
|
d97cca | 2001-11-15 | Henrik Grubbström (Grubba) | | if [ -f "$LOCALDIR/restart_rc" ]; then
dp "Running $LOCALDIR/restart_rc..."
if /bin/sh "$LOCALDIR/restart_rc"; then :; else
dp "$LOCALDIR/restart_rc failed with code $?."
fi
fi
dp "Restarting..."
|
0259c4 | 2000-08-31 | Martin Stjernholm | | done
) &
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | # Minor race here wrt pid file contents.
pid=$!
trap "" 0
|
21ae4e | 2001-10-19 | Henrik Grubbström (Grubba) | | [ -z "$pidfile" ] || { echo "x" && echo $pid; } > "$pidfile"
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | dp "Forked start script, pid $pid." 2>&3
dp "Start script pid $pid."
|
567dac | 2001-03-23 | Per Hedbor | | ) 3>&2 </dev/null >"$DEBUGDIR/start_$FILES.output" 2>&1; then
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | trap "" 0
|
0259c4 | 2000-08-31 | Martin Stjernholm | | :
|
49fff3 | 2000-01-27 | Henrik Grubbström (Grubba) | | else
|
ff3b9a | 2000-08-09 | Per Hedbor | | dp 'Failed to spawn subshell. -- Permission problem?'
|
49fff3 | 2000-01-27 | Henrik Grubbström (Grubba) | | exit 1
fi
|
0259c4 | 2000-08-31 | Martin Stjernholm | |
# Try to get rid of some fd's.
# Some /bin/sh's have problems detaching otherwise.
exec >/dev/null
exec </dev/null
|
a8135b | 1996-11-12 | Per Hedbor | | else
|
a3a0ec | 2001-03-17 | Martin Stjernholm | | start_roxen
|
a8135b | 1996-11-12 | Per Hedbor | | fi
|
941fc7 | 2001-06-20 | Fredrik Noring | |
|