Roxen.git / server / start

version» Context lines:

Roxen.git/server/start:1:   #!/bin/sh   # - # $Id: start,v 1.206 2002/11/03 20:06:42 mani Exp $ + # $Id: start,v 1.207 2002/11/17 18:40:19 mani Exp $      ### If --silent-start is given as the first argument,   ### nothing will be printed to stdout by the script.      if [ "x$1" = "x--silent-start" ] ; then    SILENT_START="y"    shift   fi      check_owner() {
Roxen.git/server/start:80:      if test -d $VARDIR/.; then :; else    dp "Creating directory $VARDIR"    ./bin/mkdir -p $VARDIR/ || exit 1   fi      # Default verbosity level.   verbose=1      # Do not default to using a relative path. - roxendir="`pwd`" + chilidir="`pwd`"      # No debug by default.   debug=-1      # Locate Pike binary.   find_pike      # Source environment   setup_environment      ####### BEGIN ARGUMENT PARSING         DEFINES="$DEFINES -DRAM_CACHE"      # Thread enabling.   # FIXME: Ought to use case...esac.      # Enable threads (if available) on Solaris. - # Most other OS's have thread bugs that cause them or Roxen to crash. + # Most other OS's have thread bugs that cause them or ChiliMoon to crash.   if uname | grep 'SunOS' >/dev/null 2>&1; then    if uname -r | grep '5\.[5-9]' >/dev/null 2>&1; then    # FIXME: What about Solaris 10+ (SunOS 5.10+)?   # if [ $verbose -gt 0 ] ; then   # dp "Solaris 2.5 or later detected. Using threads by default."   # fi    DEFINES="$DEFINES -DENABLE_THREADS"    fi   fi   # Darwin 1.4/5.x or later (Mac OS X 10.1 or newer) also uses threads.
Roxen.git/server/start:137:    # This really cannot be done from here anymore -- pass on an option    # to loader instead.    pass="$pass --remove-dumped"   }      ## Parse all arguments.   ## GNU-style, long options only, except for -D, simply passed on.   ARGS=""      setup_for_tests() { -  # Kill roxen mysql if it's running... +  # Kill ChiliMoon mysql if it's running...    if [ -f "$VARDIR/test_config/_mysql/mysql_pid" ] ; then    kill `cat "$VARDIR/test_config/_mysql/mysql_pid"`    fi    self_test=y    DEFINES="-DRUN_SELF_TEST -DSELF_TEST_DIR=\"$SELF_TEST_DIR\" $DEFINES"    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"    fi
Roxen.git/server/start:272:    # Pass any remaining arguments along to the program.    while [ ! c"$1" = "c" ] ; do    pass="$pass '`echo \"$1\" | sed -e \"s/'/'\\\"'\\\"'/g\"`'"    shift    done    break    ;;    '--cd')    cd_to="$2"    # Use the absolute path... -  roxendir="`pwd`" +  chilidir="`pwd`"    once=${once:-1}    shift    ;;    --debug-without=*|-r*|-d*|-t*|-l*|-w*|-a*|-p*|--*-debug*)    # Argument passed along to Pike.    ARGS="$ARGS $1"    ;;    -D*|-M*|-I*|-P*)    # Argument passed along to Pike.    DEFINES="$DEFINES $1"    ;;    '--version')    if [ "x$passhelp" = "x1" ] ; then    pass="$pass --version"    else    if [ -f server_core/core.pike ]; then -  echo "ChiliMoon `roxen_version`" +  echo "ChiliMoon `chilimoon_version`"    exit 0    else    echo 'server_core/core.pike not found!'    exit 1    fi    fi    ;;    --self-test-dir=*)    SELF_TEST_DIR=`echo $1 | sed -e's/--self-test-dir=//'`    ;;
Roxen.git/server/start:348:    .B--quiet -qB.: Disable most of the messages.       .B--log-dir=DIRB.: Set the log directory. Defaults to .B../logsB..       .B--config-dir=DIRB.: Use an alternate configuration directory.    Defaults to .B../configurationsB..       .B--debug-log=FILEB.: Use an alternate debuglog file.    Defaults to .B../logs/debug/B.configdirname.B.1B..    -  .B--pid-file=FILEB.: Store the roxen and startscript pids in this -  file. Defaults to .B../configurations/_roxen_pidB.. +  .B--pid-file=FILEB.: Store the ChiliMoon and startscript pids in +  this file. Defaults to +  .B../configurations/_chilimoon_pidB..       .B--silent-startB.: Inhibits output to stdout. If used,    this argument must be the first one.       .B--strip-backslashB.: Replace all \\ characters in URIs with /       .B--without-ram-cacheB.: Do not use a protocol level RAM cache to speed    things up. Saves RAM at the cost of speed.       .B--without-ram-cache-statB.: Disable the stat that is usually done
Roxen.git/server/start:398:    This is very useful when debugging. Implies    --module-debug.       .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    is frequently terminated.       .B--gdbB.: Run the server in gdb. Implies .B--onceB..    -  .B--programB.: Start a different program with the roxen -  Pike. As an example, -  .B./start --program bin/install.pikeB. will -  start the installation program normally -  started with .B./installB. +  .B--programB.: Start a different program with the    -  +  ChiliMoon Pike. As an example, +  .B./start --program bin/install.pikeB. +  will start the installation program +  normally started with .B./installB. +     .B--with-debugB.: Enable debug       .B--without-debugB.: Disable all debug. This is the default.       .B--module-debugB.: Enable more internal debug checks to -  simplify debugging of Roxen modules. +  simplify debugging of ChiliMoon modules.       .B--fd-debugB.: Enable FD debug.       .B--dump-debugB.: Enable dump debug.       .B--trussB.: (Solaris only). Run the server under    truss, shows .BallB. system calls. This is    extremely noisy, and is not intented for    anything but debug.   
Roxen.git/server/start:437:    .BArguments passed to pike:B.       .B-DDEFINEB.: Define the symbol .BDEFINEB..       .B-d<level>B.: Set the runtime Pike debug to level.    This only works if Pike is compiled    with debug (i.e. with --rtl-debug to    configure).       .B-rtB.: Enable runtime typechecking. -  Things will run more slowly, but it is very -  useful while developing code. +  Things will run more slowly, but it +  is very useful while developing +  code.    -  Enabled when starting roxen with --debug +  Enabled when starting ChiliMoon with +  --debug       .B-rTB.: Enable strict types.    Same as adding #pragma strict-types    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 +  Useful for module and ChiliMoon core    developers, but not so useful for    the occasional pike-script-writer.    -  Enabled when starting roxen with --debug +  Enabled when starting ChiliMoon with +  --debug       .B-s<size>B.: Set the stack size.       .B-M<path>B.: Add the path to the Pike module path.       .B-I<path>B.: Add the path to the Pike include path.       .B-P<path>B.: Add the path to the Pike program path.       .B-dtB.: Turn off tail recursion optimization.
Roxen.git/server/start:536:   ####### BEGIN PIKE OPTIONS      # ChiliMoon will create files as the initial user, which it expects to   # be able to read as the run-time user.   umask 022      if [ "x$PIKE_NO_DEFAULT_PATHS" = "x" ]; then    # Pike default Master-program    if [ "x$PIKE_MASTER" = "x" ]; then    if [ -f lib/master.pike ]; then -  DEFINES="$DEFINES \"-m$roxendir/lib/master.pike\"" +  DEFINES="$DEFINES \"-m$chilidir/lib/master.pike\""    elif [ -f lib/pike/master.pike ]; then -  DEFINES="$DEFINES \"-m$roxendir/lib/pike/master.pike\"" +  DEFINES="$DEFINES \"-m$chilidir/lib/pike/master.pike\""    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.    DEFINES="$DEFINES \"-m$PIKE_MASTER\""    fi   fi      # Extra module-path - DEFINES="$DEFINES \"-M$roxendir/pike_modules\"" + DEFINES="$DEFINES \"-M$chilidir/pike_modules\""      # Extra include-path - DEFINES="$DEFINES \"-I$roxendir/data/include\"" + DEFINES="$DEFINES \"-I$chilidir/data/include\""      # Extra program-path   DEFINES="$DEFINES \"-Pserver_core\" \"-P`pwd`\""      # Support for adding local pike-modules      # Extra module-path   if [ -d "$LOCALDIR/pike_modules/." ]; then    DEFINES="$DEFINES \"-M$LOCALDIR/pike_modules\""   fi
Roxen.git/server/start:637:    dp "Start script terminated."    exit 0   }      exit_fail() {    exitcode=1   }      # This is a trick to get $ROXEN_PID and arguments containing spaces   # correct at the same time. - fork_roxen() { + fork_chilimoon() {    "$@" &    ROXEN_PID=$!   }    - start_roxen() { + start_chilimoon() {    check_owner    raise_limit       if [ x$remove_dumped = x1 ] ; then    remove_old_dot_o_files "user request"    fi    if [ "x$DIR" != "x../configurations" ] ; then    args="$DEFINES $ARGS $program --config-dir='`echo \"$DIR\" | sed -e \"s/'/'\\\"'\\\"'/g\"`' $pass"    else    args="$DEFINES $ARGS $program $pass"
Roxen.git/server/start:667:    if [ "x$gdb" = "xno" ]; then    if [ $verbose -gt 0 ]; then    if [ $verbose -gt 1 -o -z "$once" ] ; then    dp "Executing $pike $args"|sed -e "s!`pwd`!.!g"    else    dp "Using the '$pike' pike binary"|sed -e "s!`pwd`!.!g"    fi    fi       if [ "x$once" = "x" ]; then -  eval "fork_roxen \"$pike\" $args 2>>\"${DEBUGLOG}.1\" 1>&2" +  eval "fork_chilimoon \"$pike\" $args 2>>\"${DEBUGLOG}.1\" 1>&2"    dp "ChiliMoon server pid $ROXEN_PID."    wait $ROXEN_PID 2>/dev/null 1>&2    exitcode="$?"    ROXEN_PID=""    else    if [ "x$do_pipe" = "x" ] ; then    if [ "x$once" = "x1" ]; then -  eval "fork_roxen \"$pike\" $args 2>&1" +  eval "fork_chilimoon \"$pike\" $args 2>&1"    wait $ROXEN_PID 2>/dev/null 1>&2    exitcode="$?"    ROXEN_PID=""    else    eval "\"$pike\" $args" 2>&1    exitcode="$?"    fi    else    trap exit_fail 1    eval "(eval \"\\\"$pike\\\" $args\" || kill -1 $$) 2>&1 $do_pipe"
Roxen.git/server/start:730:   # Now do the stuff   #      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. -  [ -z "$pidfile" ] && pidfile="${ROXEN_PID_FILE:-$DIR/_roxen_pid}" +  [ -z "$pidfile" ] && pidfile="${ROXEN_PID_FILE:-$DIR/_chilimoon_pid}"    pass="$pass --pid-file='`echo \"$pidfile\" | sed -e \"s/'/'\\\"'\\\"'/g\"`'"    # Avoid duplicate start scripts if we got a pid file.    mypid=$$    test -f "$pidfile" && { -  if read roxenpid && read scriptpid; then +  if read chilimoonpid && 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 +  elif kill -0 $chilimoonpid 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 "there is already a server running with pid $chilimoonpid, 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    } < "$pidfile" && exit 1    # Minor race here.    { echo "x" && echo $mypid; } > "$pidfile"    trap cleanup_pid_file 0   fi
Roxen.git/server/start:817:    # Thanks to Emils Klotins <emils@dot.lv> for reporting it.    if ./bin/mkdir -p "$DEBUGDIR" 2>/dev/null; then :; else    dp "Failed to create log directory $DEBUGDIR."    exit 1    fi    fi       dp "Server start at `date`"    dp "Debug log in ${DEBUGLOG}.1"    rotate "$DEBUGLOG" -  start_roxen +  start_chilimoon       if [ "$exitcode" -eq "0" ] ; then    # Clean shutdown.    dp "ChiliMoon shutdown."    signal_exit    # Not reached, but...    exit 0    fi    if [ "$exitcode" -lt "0" ] ; then    # Signal death.
Roxen.git/server/start:880:    dp 'Failed to spawn subshell. -- Permission problem?'    exit 1    fi       # Try to get rid of some fd's.    # Some /bin/sh's have problems detaching otherwise.       exec >/dev/null    exec </dev/null   else -  start_roxen +  start_chilimoon   fi