Roxen.git / server / start

version» Context lines:

Roxen.git/server/start:1:   #!/bin/sh   # - # $Id: start,v 1.119 2000/08/09 01:30:25 per Exp $ + # $Id: start,v 1.120 2000/08/09 02:34:34 per Exp $      pre="`echo \" $$ \" | sed -e 's/\(.........\)\(.*\)/\1/g'` :"    -  + dp() { +  echo "$pre" "$@" 2>&1 + } +    # Breaks on linux when using symlinks.   dn="`dirname $0`"   case "$dn" in    ""|".")    ;;    *) -  echo "Changing current directory to '$dn' (now `pwd`)" +  dp "Changing current directory to '$dn' (now `pwd`)"    cd $dn -  echo "Got `pwd`)" +  dp "Got new directory as `pwd`"    ;;   esac      # Can be set with '--config-dir=DIR'   DIR=../configurations/   LOGDIR=../logs/   FILES="default"   program=base_server/roxenloader.pike   extra_args=""   VARDIR=../var/   LOCALDIR=../local/      # Make LOCALDIR an absolute path   if test -d $LOCALDIR/.; then    LOCALDIR=`cd $LOCALDIR; pwd`   else :; fi      if test -d $VARDIR/.; then :; else -  echo "$pre Creating directory $VARDIR" +  dp "Creating directory $VARDIR"    mkdir $VARDIR || exit 1   fi      roxen_version() {    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`"    echo $VERSION.$BUILD   }      pcdir="$VARDIR/`roxen_version`/precompiled/`uname -m`.`uname -r`"
Roxen.git/server/start:53:   roxendir="`pwd`"      # Locate Pike binary.   pike=`type pike 2>/dev/null|head -1|sed -e 's,.*is ,,'`   if [ -x bin/pike ] ; then pike=$roxendir/bin/pike; fi   if [ -x bin/roxen ] ; then pike=$roxendir/bin/roxen; fi   if [ -x $LOCALDIR/bin/pike ] ; then pike=$LOCALDIR/bin/pike; fi   if [ -x $LOCALDIR/bin/roxen ] ; then pike=$LOCALDIR/bin/roxen; fi   if [ "x$PIKE" = "x" ]; then :; else    if [ -x "$PIKE" ]; then pike="$PIKE"; -  else echo "$PIKE is not executable."; fi +  else dp "$PIKE is not executable."; fi   fi         if [ x"$pike" = "x" ] ; then -  echo "No pike binary found. Aborting." +  dp "No pike binary found. Aborting."    exit 1   fi      if [ ! -f "$pike" ] ; then -  echo "No pike binary found. Aborting." +  dp "No pike binary found. Aborting."    exit 1   fi      # If environment file doesn't exist, try to create it.   if    test ! -f $LOCALDIR/environment && test -f bin/buildenv.pike   then    $pike bin/buildenv.pike   fi   
Roxen.git/server/start:96:      ####### BEGIN ARGUMENT PARSING         DEFINES="$DEFINES -DKEEP_ALIVE"      # 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 -  echo "$pre Solaris 2.5 or later detected. Defaulting to enabled threads." -  fi + # if [ $verbose -gt 0 ] ; then + # dp "Solaris 2.5 or later detected. Using threads by default." + # fi    DEFINES="$DEFINES -DENABLE_THREADS"    fi   fi      gdb=no      remove_old_dot_o_files () { -  echo "$pre Removing old .o files ($1)" +  dp "Removing old .o files ($1)"    find $pcdir -name '*.o' | xargs rm -f   }      ## Parse all arguments.   ## GNU-style, long options only, except for -D, simply passed on.   ARGS=""      parse_args() {    while [ ! c"$1" = "c" ] ; do    case $1 in
Roxen.git/server/start:371:    exit 0    ;;    *)    pass="$pass $1"    ;;    esac    shift    done   }    + if [ ! "X$ROXEN_ARGS" = "X" ]; then +  parse_args $ROXEN_ARGS + fi +    parse_args $@    -  + # The work has already been done above, but the debug printout is better + # to have _after_ parse_args (consider --help and --version) +    if [ ! "X$ROXEN_ARGS" = "X" ]; then    if [ $verbose -gt 0 ]; then -  echo "$pre Using $ROXEN_ARGS from ROXEN_ARGS." +  dp "Used $ROXEN_ARGS from ROXEN_ARGS."    else :; fi -  parse_args $ROXEN_ARGS +    fi    -  +  + 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 +  dp "Solaris 2.5 or later was detected. Threads enabled by default." +  fi +  fi + fi +  +    if [ ! "X$pass" = "X" ] ; then set -- $pass ;fi         ####### 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.
Roxen.git/server/start:464:    fi       # Extra program-path    DEFINES="$DEFINES -P$LOCALDIR/etc"   fi      # Extra kludge for HPUX   # HPUX doesn't like group 60001(nobody)   if uname | grep 'HP-UX' >/dev/null 2>&1; then    if [ $verbose -gt 0 ]; then -  echo "$pre WARNING: Applying kludge for HPUX. (see base_server/privs.pike)" +  dp "WARNING: Applying kludge for HPUX. (see base_server/privs.pike)"    else :; fi    DEFINES="$DEFINES -DHPUX_KLUDGE"   fi         case "x$debug" in    "x")    DEBUG="-DMODULE_DEBUG "    ARGS="$ARGS -w"    ;;
Roxen.git/server/start:513:    args="$DEFINES $ARGS $program --config-dir=$DIR $pass"    else    args="$DEFINES $ARGS $program $pass"    fi    if [ x$cd_to != x ] ; then    cd $cd_to    fi    if [ "x$gdb" = "xno" ]; then    if [ $verbose -gt 0 ]; then    if [ $verbose -gt 1 -o -z "$once" ] ; then -  echo "$pre" "Executing $pike $args $@"|sed -e "s!`pwd`!.!g" +  dp "Executing $pike $args $@"|sed -e "s!`pwd`!.!g"    else -  echo "$pre" "Using '$pike'"|sed -e "s!`pwd`!.!g" +  dp "Using '$pike'"|sed -e "s!`pwd`!.!g"    fi    fi    $pike $args $@    else -  echo "$pre" Executing gdb $pike $args $@ +  dp "Executing gdb $pike $args $@"    echo >.gdbinit handle SIGPIPE nostop noprint pass    echo >>.gdbinit handle SIGUSR1 nostop noprint pass    echo >>.gdbinit handle SIGUSR2 nostop noprint pass    echo >>.gdbinit handle SIGLWP nostop noprint pass    echo >>.gdbinit run $args $@    gdb $pike    rm .gdbinit    fi   }   
Roxen.git/server/start:546:      if [ "$program" = "base_server/roxenloader.pike" ] ; then    if [ "`cat $old_roxen_defines 2>/dev/null`" != "$PIKEVERSION $DEFINES" ] ; then    remove_old_dot_o_files "defines or pike version changed"    fi    echo "$PIKEVERSION $DEFINES" > $old_roxen_defines   fi      if [ -z "$once" ] ; then    if [ $verbose -gt 0 ]; then -  echo "$pre" Starting the Roxen World Wide Web server. +  dp "Starting the Roxen World Wide Web server."    else :; fi    ./mkdir -p $LOGDIR/debug/       if [ $verbose -gt 0 ]; then    cat << oo   Using configuration from $DIR, storing the debug log in $LOGDIR/debug/$FILES.1   You can use the administration interface in the server to get debug info.   oo    else :; fi   
Roxen.git/server/start:568:    # Some /bin/sh's have problems detaching otherwise.       exec >/dev/null    exec </dev/null       if ((while : ; do    if test -d "$LOGDIR/debug/."; then :; else    # Avoid infinite loop if the debug directory is deleted.    # Thanks to Emils Klotins <emils@dot.lv> for reporting it.    if ./mkdir -p "$LOGDIR/debug/"; then :; else -  echo "Failed to create log directory $LOGDIR/debug/." 1>&2 +  dp "Failed to create log directory $LOGDIR/debug/."    exit 1    fi    fi    -  echo "$pre" "Server restart at `date`" -  echo "$pre" "Debug log in $LOGDIR/debug/$FILES.1" +  dp "Server restart at `date`" +  dp "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." +  dp "Roxen shutdown."    exit 0    fi    if [ "$exitcode" -lt "0" ] ; then    # Signal death. -  echo "$pre" "Roxen died of signal $exitcode. Restarting..." +  dp "Roxen died of signal $exitcode. Restarting..."    else -  echo "$pre" Roxen down. Restarting. +  dp "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 +  dp 'Failed to spawn subshell. -- Permission problem?'    exit 1    fi   else    start_roxen $extra_args 2>&1   fi