Branch: Tag:

2003-12-15

2003-12-15 22:49:25 by Peter Bortas <zino@lysator.liu.se>

Added --pid-file=

Rev: aido-server.in:1.13

14:   fi      LOG='@DIR@/logs/server-debug' + DEFLOG="$LOG" + PIDFILE="$HOME/.aido/pid" + DEFPIDFILE="$PIDFILE"      while [ ! c"$1" = "c" ] ; do    case "$1" in
24:    once=1    ;;    '--kill'|'--stop') -  if [ -f $HOME/.aido/pid ]; then -  PID=`cat $HOME/.aido/pid` +  if [ -f $PIDFILE ]; then +  PID=`cat $PIDFILE`    kill $PID && wait $PID 2>/dev/null    fi    exit 0    ;;    '--restart') -  if [ -f $HOME/.aido/pid ]; then -  PID=`cat $HOME/.aido/pid` +  #FIXME: Doesn't use last sessions options. +  if [ -f $PIDFILE ]; then +  PID=`cat $PIDFILE`    kill -HUP $PID    fi    exit 0
51:    '--log=*')    LOG=`echo $1 | sed -e 's/--log=//'`    ;; +  '--pid-file=*') +  PIDFILE=`echo $1 | sed -e 's/--pid-file=//'` +  ;;    '--help'|'-?')    sed -e "s/\\.B/`tput 'bold' 2>/dev/null`/g" -e "s/B\\./`tput 'sgr0' 2>/dev/null`/g" << EOF   This command will start the AIDO MediaPlayer backend server (version $VERSION).
71:    .B--kill --stopB.: Kill the running server, without restarting it    .B--restartB.: Kill the running server, restarting it afterwards    .B--log=fileB.: Use the specified file as the debug log. -  default is $LOG +  default is $DEFLOG +  .B--pid-file=fileB.: Use the specified file as the PID file. +  default is $DEFPIDFILE      EOF    tput 'rmso' 2>/dev/null
121:      AIDO_PID=""   if [ x$once = 'x0' ] ; then -  if [ -f $HOME/.aido/pid ]; then -  PID=`cat $HOME/.aido/pid` +  if [ -f $PIDFILE ]; then +  PID=`cat $PIDFILE`    if kill -0 $PID 2>/dev/null ; then    echo Server already running with PID $PID.    exit 1
138:    start_server > $LOG 2>&1 < /dev/null    done    ) >/dev/null 2>&1 & +  #FIXME: Check that dirname $PIDFILE exists.    test -d $HOME/.aido || mkdir $HOME/.aido -  echo $! >$HOME/.aido/pid +  echo $! >$PIDFILE   else    trap signal_exit 2 15 -  echo $$ >$HOME/.aido/pid +  echo $$ >$PIDFILE    start_server   fi