view initscript @ 195:3bdee6371c3f

Change various filenames. The shell script previously used to launch the daemon is now called "initscript". The script files have had the ".js" extension removed from their names.
author John "Elwin" Edwards
date Thu, 14 Jan 2016 20:52:29 -0500
parents rlgwebd@5483d413a45b
children 298a531776d6
line wrap: on
line source

#!/bin/sh

NODE_PATH=/usr/lib/node_modules
LOGFILE=/var/log/rlgwebd.log
CTLSOCKET=/var/run/rlgwebd.sock
RLGWEBDJS=./rlgwebd

export NODE_PATH

if [ $UID != 0 ]
then
  echo "$0 needs to run as root." >&2
  exit 1
fi

if [ $# -gt 0 ] && [ $1 = stop ]
then
  socat "EXEC:echo quit" "$CTLSOCKET"
else
  # Start
  setsid node "$RLGWEBDJS" </dev/null &>>$LOGFILE &
fi

exit