annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
139
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
1 #!/bin/sh
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
2
141
1a156a7746a7 RLGWebD: use NODE_PATH to find modules.
John "Elwin" Edwards
parents: 139
diff changeset
3 NODE_PATH=/usr/lib/node_modules
139
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
4 LOGFILE=/var/local/rlgwebd/log
194
5483d413a45b RLGWebD: move the control socket into /var/run.
John "Elwin" Edwards
parents: 141
diff changeset
5 CTLSOCKET=/var/run/rlgwebd.sock
139
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
6 RLGWEBDJS=./rlgwebd.js
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
7
141
1a156a7746a7 RLGWebD: use NODE_PATH to find modules.
John "Elwin" Edwards
parents: 139
diff changeset
8 export NODE_PATH
1a156a7746a7 RLGWebD: use NODE_PATH to find modules.
John "Elwin" Edwards
parents: 139
diff changeset
9
139
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
10 if [ $UID != 0 ]
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
11 then
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
12 echo "$0 needs to run as root." >&2
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
13 exit 1
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
14 fi
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
15
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
16 if [ $# -gt 0 ] && [ $1 = stop ]
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
17 then
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
18 socat "EXEC:echo quit" "$CTLSOCKET"
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
19 else
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
20 # Start
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
21 setsid node "$RLGWEBDJS" </dev/null &>>$LOGFILE &
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
22 fi
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
23
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
24 exit
dcd07c1d846a Replace the daemon module with posix.
John "Elwin" Edwards
parents:
diff changeset
25