2 Replies Latest reply on Jan 11, 2012 10:50 AM by metallist

    Start Infinispan HotRod server as a service on Linux

    metallist

      Happy New Year!

       

      Here's my situation:  I'm planning on using Infinispan HotRod server (v. 4.2.1) for caching purposes in a project. I want to start the server as a service on Linux, just the way I start JBoss (I'm using JBoss 6.1.0). Are there any specific recommendations on how I should run the Infinispan server or will the general guidelines for JBoss (as described here: http://community.jboss.org/wiki/StartJBossOnBootWithLinux) do?

       

      Haven't found anything on the subject in the Infinispan wiki, so I hope to get a little help here

        • 1. Re: Start Infinispan HotRod server as a service on Linux
          galder.zamarreno

          We don't have anything on this so far, but following the simple example provided in the first answer to http://stackoverflow.com/questions/6880902/start-jboss-7-as-a-service-on-linux, it should be pretty easy to build one. Make sure the start phase points to the startServer.sh script. To stop though, we do not have any commands, so remove the stop part from the header and the script itself. If you wanna stop manually, you'll have to do a kill -6. If you get it working, make sure you contribute it back

          1 of 1 people found this helpful
          • 2. Re: Start Infinispan HotRod server as a service on Linux
            metallist

            Thank you for your help, Galder. Based on your recommendation our systems administrator (he's way better in bash scripting than me ) was able to come up with the following solution:

            {code}

            #!/bin/bash
            #

            # Init file for Infinispan cache daemon
            #
            # chkconfig: 2345 99 25
            # description: Infinispan cache daemon

            #

            # source function library

            . /etc/rc.d/init.d/functions

            case "$1" in

            start)

                 cd /opt/infinispan/bin

                 su - infinispan -c '/opt/infinispan/bin/startServer.sh -rhotrod -cconfig.xml' &

                 touch /var/lock/subsys/infinispan

                 ;;

            stop)

                 sudo -u infinispan kilall java

                 sleep 5

                 sudo -u infinispan killall -9 java

                 rm /var/lock/subsys/infinispan

                 ;;

            *)

                 echo $"Usage: $0 (start|stop)"

                 RETVAL=1

            esac

            exit $RETVAL

            {code}

             

            We put this into /etc/init.d on our system & are able to launch infinispan as a service. This may not look very neat, but it works for us in our development environment. Any fixes are welcome & appreciated.