2012-05-23 14:25:42 +00:00
|
|
|
#!/bin/sh
|
2012-05-24 08:24:14 +00:00
|
|
|
# Wrapper for Parsoid web service (server.js and ParserService.js)
|
|
|
|
|
2012-05-23 14:25:42 +00:00
|
|
|
# redirect port 80 to unprivileged port 8000
|
2012-05-24 08:24:14 +00:00
|
|
|
if ! `iptables -tnat -L | grep -q 'tcp dpt:http redir ports 8000'`;then
|
|
|
|
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8000
|
|
|
|
fi
|
|
|
|
|
|
|
|
# update the source
|
|
|
|
git pull
|
|
|
|
|
|
|
|
# kill a running server (crude version..)
|
2012-07-26 00:00:43 +00:00
|
|
|
killall -9 node
|
2012-05-23 14:25:42 +00:00
|
|
|
|
|
|
|
# run the server as non-privileged user
|
2012-07-25 01:25:49 +00:00
|
|
|
nohup sudo -u nobody node server.js >> nohup.out 2>&1 &
|