view rlgwebd @ 194:5483d413a45b

RLGWebD: move the control socket into /var/run. This is a more standard location. /run is preferred by systemd, but portability to non-systemd systems is important.
author John "Elwin" Edwards
date Thu, 14 Jan 2016 19:10:46 -0500
parents 1a156a7746a7
children
line wrap: on
line source

#!/bin/sh

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

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