Roxen.git / server / tools / init.d_roxen

version» Context lines:

Roxen.git/server/tools/init.d_roxen:1:   #!/bin/sh   # init.d script for Roxen. Set the variables below to something fitting..   # This is only an example script. - # $Id: init.d_roxen,v 1.32 2012/01/12 16:42:03 grubba Exp $ + # $Id$   ############# -  + ### BEGIN INIT INFO + # Provides: roxen + # Required-Start: $local_fs $syslog $named $network $time + # Required-Stop: $local_fs $syslog $named $network + # Should-Start: + # Should-Stop: + # Default-Start: 2 3 4 5 + # Default-Stop: 0 1 6 + # Description: Roxen Webserver + ### END INIT INFO      # Configurations collection directory. If available, it overrides   # roxenhome below.   # - roxenconfdirs=/etc/roxen + roxenconfdir=/etc/roxen      # The server directory where the 'start' script is located, if available.   #   roxenhome=/usr/local/roxen      # Set these to kill all processes owned by wwwuser on stop. Useful to   # reap CGI scripts.   #   # killallwww=yes   # wwwuser=www
Roxen.git/server/tools/init.d_roxen:58:    okexit="$SMF_EXIT_OK"       # roxen/dir ==> roxenhome    if svcprop -q -p roxen/dir ${SMF_FMRI}; then    val=`svcprop -p roxen/dir ${SMF_FMRI}`    if [ "$val" != "\"\"" ] ; then    roxenhome="$val"    fi    fi    -  # roxen/confdirs ==> roxenconfdirs -  if svcprop -q -p roxen/confdirs ${SMF_FMRI}; then -  val=`svcprop -p roxen/confdirs ${SMF_FMRI}` +  # roxen/confdir ==> roxenconfdir +  if svcprop -q -p roxen/confdir ${SMF_FMRI}; then +  val=`svcprop -p roxen/confdir ${SMF_FMRI}`    if [ "$val" != "\"\"" ] ; then -  roxenconfdirs="$val" +  roxenconfdir="$val"    fi    fi   fi      find_server_dir()   {    (    cd "$roxenhome" >/dev/null 2>&1 &&    for dir in server*; do    ( cd "$dir" >/dev/null 2>&1 &&
Roxen.git/server/tools/init.d_roxen:90:      # Some systems have stupid rc scripts that are written in shells with job   # support (read Linux/bash), and send SIGHUP when they finish.   trap "" 1      run_server()   {    test x"$pidfile" = x && pidfile="$configdir"/_roxen_pid    flags="$flags --pid-file=$pidfile"    +  if [ -x "$roxenhome/start" ]; then :; else +  echo "Cannot find a Roxen installation in $roxenhome." +  exit $errexit +  fi +     case $1 in    'start_msg')    echo "Start Roxen in $roxenhome."    exit $okexit    ;;    'stop_msg')    echo "Stop Roxen in $roxenhome."    exit $okexit    ;;       'start')    echo "Starting Roxen in $roxenhome..."    cd $roxenhome && { -  test -f "$pidfile" && { -  if read pid && read pid && kill -0 "$pid" 2>/dev/null; then -  echo "Roxen is already running (start script pid $pid)." -  : -  else false; fi -  } < $pidfile && exit $okexit -  if [ -x $roxenhome/start ]; then -  ./start $flags 2>/dev/null +  ./start $flags 2>/dev/null && {    echo "Roxen started."    exit $okexit -  fi -  echo "Cannot find a Roxen installation in $roxenhome." +     } -  +  echo "Failed to start Roxen. Already running?" +  }    ;;       'reload')    echo "Reloading configurations in Roxen in $roxenhome..."    cd $roxenhome && { -  if test -f "$pidfile" && read pid < $pidfile && test "$pid" != x; then -  echo "Sending SIGHUP to Roxen process $pid." -  kill -1 $pid && exit $okexit -  fi -  test -f "$pidfile" && { -  if read pid && read pid && kill -0 "$pid" 2>/dev/null; then -  echo "The start script is currently forking a new server - nothing to do." -  : -  else false; fi -  } < $pidfile && exit $okexit +  echo "Sending SIGHUP to Roxen process." +  ./start --signal 1 $flags 2>/dev/null && exit $okexit    echo "Roxen doesn't seem to be running."    }    ;;       'restart')    echo "Restarting Roxen in $roxenhome..."    cd $roxenhome && { -  if test -f "$pidfile" && read pid < $pidfile && test "$pid" != x; then -  echo "Sending SIGTERM to Roxen process $pid." -  kill $pid && exit $okexit -  fi -  test -f "$pidfile" && { -  if read pid && read pid && kill -0 $pid 2>/dev/null; then -  echo "The start script is currently forking a new server - nothing to do." -  : -  else false; fi -  } < $pidfile && exit $okexit -  echo "Roxen doesn't seem to be running." -  echo "Starting Roxen in $roxenhome." -  if [ -x $roxenhome/start ]; then -  ./start $flags 2>/dev/null +  ./start --restart $flags 2>/dev/null && {    echo "Roxen started."    exit $okexit -  fi -  echo "Cannot find a Roxen installation in $roxenhome." +     } -  +  echo "Failed to restart Roxen." +  }    ;;       'stop')    echo "Stopping Roxen in $roxenhome..." -  cd $roxenhome && { -  test -f "$pidfile" && { -  if read pid && read pid; then -  echo "Sending SIGTERM to start script process $pid." -  if kill "$pid"; then -  while kill -0 $pid 2>/dev/null; do -  sleep 1 -  done +  cd "$roxenhome" && { +  ./start --stop $flags 2>/dev/null && {    echo "Roxen stopped." -  # Get all the CGI scripts... :-) -  if [ x$killallwww = xyes ] ; then -  echo "Killing all programs running as the $wwwuser user." -  su $wwwuser -c "kill -9 -1" -  fi -  : -  else false; fi -  else false; fi -  } < $pidfile && exit $okexit -  echo "Roxen doesn't seem to be running." +  exit $okexit    } -  +  echo "Failed to stop Roxen." +  }    ;;       'status')    cd "$roxenhome" && { -  test -f "$pidfile" && { -  if read pid && read pid && ps -p "$pid" >/dev/null -  then -  echo "Roxen is running (start script pid $pid)." -  : -  else -  false +  if ./start --signal 0 $flags 2>/dev/null; then +  echo "Roxen is running." +  status=0 +  return 0    fi -  } < "$pidfile" && status=0 && return +     echo "Roxen is not running." -  exit $errexit +     }    ;;       'debug') -  echo "Sending Roxen SIGQUIT..." -  cd $roxenhome && { -  test -f "$pidfile" && { -  if read pid && kill -QUIT "$pid" 2>/dev/null; then -  echo "Roxen process found. Consult debug log for output." -  : -  else echo "pid $pid"; fi -  } < $pidfile && exit $okexit +  cd "$roxenhome" && { +  echo "Sending SIGQUIT to Roxen process $pid." +  ./start --signal QUIT $flags 2>/dev/null && exit $okexit    echo "Roxen doesn't seem to be running." -  exit $errexit +     }    ;;       *)    echo "Usage: $0 [start|stop|status|start_msg|stop_msg|restart|reload|debug]"    ;;    esac    exit $errexit   }   
Roxen.git/server/tools/init.d_roxen:254:    mkdir -p `dirname "$ROXEN_PID_FILE"`    fi    test -n "$ROXEN_PID_FILE" && pidfile="$ROXEN_PID_FILE"    if [ x"$ROXEN_LOGDIR" != x ]    then    DEBUGLOG="$ROXEN_LOGDIR"/debug/default    export DEBUGLOG    fi   }    - if [ -d "$roxenconfdirs" ] + if [ -d "$roxenconfdir" ]   then    if [ -z "$1" ]    then    echo "Usage: $0 [start|stop|status|start_msg|stop_msg|restart|reload|debug] <instance name>"    exit $errexit    fi    if [ -z "$2" ]    then    flagsorig="$flags" -  for f in "$roxenconfdirs"/* +  for f in "$roxenconfdir"/*    do    flags="$flagsorig"    get_variables "$f"    run_server "$1"    done    else -  get_variables "$roxenconfdirs"/"$2" +  get_variables "$roxenconfdir"/"$2"    run_server "$1"    fi   else    if test x"$configdir" = x    then    configdir=../configurations    else    flags="$flags --config-dir=$configdir"    fi       roxenhome=`find_server_dir`    run_server "$@"   fi