Topic on Talk:Parsoid

How to start parsoid automatically?

4
Summary by Arlolra

Not familiar w/ CentOS

Hadiov (talkcontribs)

Hello

What should I do to activate and start parsoid ( server.js) automatically when the server starts working?

CentOS 6.7

Thanks

SSastry (WMF) (talkcontribs)

None of us are familiar with CentOS 6.7 .. but, someone showed up on IRC recently (not sure if it was you or someone else) asking about CentOS 6.* and said that they would give us updated instructions once they get it figured out. At that point, we'll update our setup instructions so others on similar installs can benefit from it. But, at this point, we ourselves are not able to help you out directly. Sorry about that.

111.69.143.217 (talkcontribs)

Assuming that you have created a /etc/init.d/parsoid script, to make parsoid auto-start (on centos 6) you need to run (once):

chkconfig parsoid on

BTW, our /etc/init.d/parsoid script is:

#! /bin/bash

  #

  # 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 /opt/parsoid

          nohup node /opt/parsoid/bin/server.js > /dev/null 2>&1 &

          $0 status

         ;;

    stop)

          process=`ps -ef | grep 'node /opt/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 /opt/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

  exit $rc

Cscott (talkcontribs)

It would probably be better to redirect parsoid's console output to >> /var/log/parsoid/parsoid.log instead of > /dev/null. (See question above about missing log files on CentOS.)