MediaWikiGids: Parsoid
Uit MediaWikiGids
Autostart van Parsoid op CentOS 6 server
Omdat Centos 6 (nog) geen gebruik maakt van systemd om scripts te starten bij de opstart van de server, is een eigen startup script nodig. CentOS 7 maakt wel gebruik van systemd.
Plaats van startup script:/etc/init.dNa plaatsen van script eenmalig uitvoeren:
chkconfig parsoid onStartup script
# parsoid start
#
# chkconfig: 345 86 14
# description: parsoid
#
### BEGIN INIT INFO
# Provides: $parsoid
### END INIT INFO
# Source function library.
. /etc/init.d/functions
rc=0
# See how we were called.
case "$1" in
start)
echo starting parsoid
cd /path/to/directory/parsoid
nohup node /path/to/directory/parsoid/bin/server.js > /dev/null 2>&1 &
$0 status
;;
stop)
process=`ps -ef | grep 'node /path/to/directory/parsoid/bin/server.js'| grep -v grep | awk '{print $2}'`
if [ "${process}" != '' ]
then
echo stopping parsoid
killall -9 node
fi
$0 status
;;
status)
proc_find=`ps -ef | grep 'node /path/to/directory/parsoid/bin/server.js'| grep -v grep`
if [ "${proc_find}" = '' ]
then
echo parsoid is not running
else
echo parsoid is running: ${proc_find}
fi
;;
restart|reload)
cd "$CWD"
$0 status
$0 stop
$0 start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac