Mercurial > hg > rlgwebd
annotate 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 |
rev | line source |
---|---|
139 | 1 #!/bin/sh |
2 | |
3 LOGFILE=/var/local/rlgwebd/log | |
4 CTLSOCKET=/var/local/rlgwebd/ctl | |
5 RLGWEBDJS=./rlgwebd.js | |
6 | |
7 if [ $UID != 0 ] | |
8 then | |
9 echo "$0 needs to run as root." >&2 | |
10 exit 1 | |
11 fi | |
12 | |
13 if [ $# -gt 0 ] && [ $1 = stop ] | |
14 then | |
15 socat "EXEC:echo quit" "$CTLSOCKET" | |
16 else | |
17 # Start | |
18 setsid node "$RLGWEBDJS" </dev/null &>>$LOGFILE & | |
19 fi | |
20 | |
21 exit | |
22 |