Mercurial > hg > rlgwebd
diff rlgwebd @ 139:dcd07c1d846a
Replace the daemon module with posix.
The daemon module doesn't include chroot() anymore, so a replacement
is needed. Detaching a daemon keeps getting harder to do in Node, so
some setup has been moved into a shell script.
author | John "Elwin" Edwards |
---|---|
date | Sat, 20 Jul 2013 12:23:53 -0700 |
parents | |
children | 1a156a7746a7 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rlgwebd Sat Jul 20 12:23:53 2013 -0700 @@ -0,0 +1,22 @@ +#!/bin/sh + +LOGFILE=/var/local/rlgwebd/log +CTLSOCKET=/var/local/rlgwebd/ctl +RLGWEBDJS=./rlgwebd.js + +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 +