Branch: Tag:

2005-12-21

2005-12-21 14:03:33 by Fredrik Noring <noring@nocrew.org>

Use ROXEN_DATADIR, ROXEN_LICENSEDIR etc. Added --stop option to stop a server.

Rev: server/start:1.224

1:   #!/bin/sh   # - # $Id: start,v 1.223 2005/11/18 16:44:03 grubba Exp $ + # $Id: start,v 1.224 2005/12/21 14:03:33 noring Exp $      ### If --silent-start is given as the first argument,   ### nothing will be printed to stdout by the script.
68:      # Can be set with '--config-dir=DIR'   DIR=../configurations + if [ ! "x$ROXEN_CONFIGDIR" = "x" ] + then +  DIR="$ROXEN_CONFIGDIR" + fi   LOGDIR=../logs -  + if [ ! "x$ROXEN_LOGDIR" = "x" ] + then +  LOGDIR="$ROXEN_LOGDIR" + fi   FILES="default"   program=base_server/roxenloader.pike   VARDIR=../var   LOCALDIR=../local -  + if [ ! "x$ROXEN_DATADIR" = "x" ] + then +  VARDIR="$ROXEN_DATADIR"/var +  LOCALDIR="$ROXEN_DATADIR"/local +  +  if [ -d "$ROXEN_DATADIR"/license ] +  then +  ROXEN_LICENSEDIR="$ROXEN_DATADIR"/license +  else +  ROXEN_LICENSEDIR="$DIR"/_license +  fi +  export ROXEN_DATADIR ROXEN_LICENSEDIR + fi + export LOCALDIR LOGDIR VARDIR   SELF_TEST_DIR=etc/test      # Make LOCALDIR an absolute path
195:    ;;    --log-dir=*)    LOGDIR=`echo $1 | sed -e 's/--log-dir=//'` +  export LOGDIR    ;;    --debug-log=*)    DEBUGLOG=`echo $1 | sed -e's/--debug-log=//'`
262:    '--remove-dumped')    remove_dumped=1;    ;; +  '--stop') +  stop=1; +  ;;       '--once')    once=${once:-1}
416:    This is very useful when debugging. Implies    --module-debug.    +  .B--stopB.: Stop the server. +     .B--keep-mysqlB.: Do not shut down MySQL process when exiting    the start script. Useful during development    or any other scenario where the start script
812:    # Starting a Roxen server. Fix the pid file.    [ -z "$pidfile" ] && pidfile="${ROXEN_PID_FILE:-$DIR/_roxen_pid}"    pass="$pass --pid-file='`echo \"$pidfile\" | sed -e \"s/'/'\\\"'\\\"'/g\"`'" +  # Check for stop. +  if [ "$stop"x != x ] && [ -f "$pidfile" ] +  then +  pids=`cat "$pidfile"` +  echo "$pids" | xargs kill +  while kill -0 $pids 2>/dev/null +  do +  sleep 1 +  done +  exit +  fi    # Avoid duplicate start scripts if we got a pid file.    mypid=$$    test -f "$pidfile" && {