Mercurial > hg > rlgwebd
view rlgwebd @ 157:e7f809f06c5c
Use posix.getpwnam() to look up UID/GID to drop to.
This is more reliable than hardcoding the numbers.
author | John "Elwin" Edwards |
---|---|
date | Mon, 12 May 2014 08:59:47 -0700 |
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