mediawiki-extensions-Visual.../api/runserver.sh
Gabriel Wicke a5c96be8b7 Improve shell wrapper for parsoid service
Change-Id: I92c536af60613705229faea97a26d1486d4730a1
2012-05-24 10:24:14 +02:00

17 lines
443 B
Bash
Executable file

#!/bin/sh
# Wrapper for Parsoid web service (server.js and ParserService.js)
# redirect port 80 to unprivileged port 8000
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..)
killall node
# run the server as non-privileged user
nohup sudo -u nobody node server.js &