-
1. Re: Start Infinispan HotRod server as a service on Linux
galder.zamarreno Jan 3, 2012 9:03 AM (in response to metallist)1 of 1 people found this helpfulWe 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
-
2. Re: Start Infinispan HotRod server as a service on Linux
metallist Jan 11, 2012 10:50 AM (in response to galder.zamarreno)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" instart)
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.