Roxen.git / server / start

version» Context lines:

Roxen.git/server/start:1:   #!/bin/sh   # - # $Id: start,v 1.247 2012/09/26 15:44:15 grubba Exp $ + # $Id: start,v 1.248 2012/09/27 10:04:49 grubba 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:788:   #      # Check whether there's a valid pid lock on pid $1   # of process type $2 for configuration $3.   check_pid_file_lock() {    # Check that there's a lock-file.    #    # Primary check is in /var/run/ which often is restricted to root.    # Secondary check is in /tmp/ to allow for normal users running    # the script unmodified. -  if [ "$verbose" -g 1 ]; then +  if [ "$verbose" -gt 1 ]; then    dp "Checking pid-file lock roxen-$2.$1.pid for configuration $3."    fi    if [ -f "/var/run/roxen-$2.$1.pid" -o -f "/tmp/roxen-$2.$1.pid" ]; then    # Check that the pid file belongs to our configuration.    if [ "x$3" = "x" -o "x`cat /var/run/roxen-$2.$1.pid 2>/dev/null || cat /tmp/roxen-$2.$1.pid 2>/dev/null`" = "x$3" ]; then    return 0    fi    fi    return 1   }
Roxen.git/server/start:1057:   #      trap signal_exit 2 15   trap "" 1      if [ "$program" = "base_server/roxenloader.pike" ] ; then    # 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" ] +  if [ "$stop"x != x ]    then -  if read roxenpid && read scriptpid && \ -  roxenp "$scriptpid" "start" "$canonicalconf"; then -  pids=`cat "$pidfile"` -  echo "$pids" | xargs kill -  cat "$pidfile" | while read pid; do +  if [ -f "$pidfile" ]; then +  if read roxenpid && read scriptpid; then +  problems="" +  if roxenp "$scriptpid" "start" "$canonicalconf"; then +  dp "Shutting down the start script..." +  kill "$scriptpid"    while processp $pid 2>/dev/null; do -  echo "Waiting for $pid to die." >&2 +  echo "Waiting for start script $pid to die." >&2    sleep 1    done -  +  else +  problems="nostart" +  fi +  # NB: At this point the original start script has +  # often already shut down the server, but... +  if roxenp "$roxenpid" "server" "$canonicalconf"; then +  dp "Shutting down the server..." +  kill "$roxenpid" +  while processp $roxenpid 2>/dev/null; do +  echo "Waiting for roxen $roxenpid to die." >&2 +  sleep 1    done    else -  +  problems="$problems:noserver" +  fi +  if [ "$problems" = "nostart:noserver" ]; then    dp "There is a pid file $pidfile," -  dp "but the corresponding processes do not exist." +  dp "but the corresponding processes do not exist," +  dp "or are not associated with this configuration."    dp "Stale pid file? Deleting the pid file."    rm "$pidfile"    : -  +  fi +  else +  dp "There is a pid file $pidfile," +  dp "but it seems to be truncated." +  exit 1    fi < "$pidfile" -  +  else +  dp "The pid file $pidfile does not exist." +  dp "The server is probably not running." +  fi    exit    fi    # Avoid duplicate start scripts if we got a pid file.    test -f "$pidfile" && {    if read roxenpid && read scriptpid; then    if roxenp "$scriptpid" "start" "$canonicalconf" 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."