view rlgwebd @ 158:9961a538c00e

rlgwebd.js: get rid of numerical game identifiers. Games will be indentified by gamename/username pairs. This will allow better interoperability with dgamelaunch. Polling clients are no longer supported; the code remnants need to be removed. The reaper() function will likely crash. Unexpectedly, the WebSocket client still works well enough to play. Watching and listing current games are probably broken.
author John "Elwin" Edwards
date Thu, 01 Jan 2015 15:56:22 -0500
parents 1a156a7746a7
children 5483d413a45b
line wrap: on
line source

#!/bin/sh

NODE_PATH=/usr/lib/node_modules
LOGFILE=/var/local/rlgwebd/log
CTLSOCKET=/var/local/rlgwebd/ctl
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