Once Parsoid is installed on openSUSE it might be handy to have is started automatically once system is restarted.

First we have to create startup script.

/etc/init.d/parsoid

#!/bin/sh

#
# description: Node.js /srv/parsoid/api/server.js
#

. /etc/rc.status

USER="root"

DAEMON="/usr/bin/node"
ROOT_DIR="/srv/parsoid/api"
LOG_ROOT="/var/log/nodejs"

SERVER="$ROOT_DIR/server.js"
LOG_FILE="$LOG_ROOT/parsoid.log"

LOCK_FILE="/var/lock/subsys/node-server"

WORKERS_NUMBER=8

do_start()
{
if [ ! -f "$LOCK_FILE" ] ; then
echo -n $"Starting $SERVER: "
runuser -l "$USER" -c "$DAEMON $SERVER -n $WORKERS_NUMBER >> $LOG_FILE &" && echo || echo
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCK_FILE
else
echo "$SERVER is locked."
RETVAL=1
fi
}
do_stop()
{
echo -n $"Stopping $SERVER: "
pid=`ps -aefw | grep "$DAEMON $SERVER" | grep -v " grep " | awk '{print $2}'`
kill -9 $pid > /dev/null 2>&1 && echo || echo
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
}

case "$1" in
start)
do_start
;;
stop)
do_stop
;;
restart)
do_stop
do_start
;;
*)
echo "Usage: $0 {start|stop|restart}"
RETVAL=1
esac

exit $RETVAL
Remember to adjust all paths and number of worker processes accordingly to your installation.

Once startup script is in place we have to enable Parsoid to be automatically started:

chkconfig parsoid on

From now on Parsoid will be automatically started after each restart.