Infinispan Start Up Script


We are building our new Penatho platform and to get some speed out of the analysis we are going to use the Infinispan cache that Pentaho supports.

As with all open source platform software, you get the standard phrase install an Infinispan server, this is OK Pentaho can not document everything !!!.

 

So over to http://infinispan.org/ to get the software and instructions.

To be fair the Infinispan in the simple form that we need can run stand alone, so you install Java JDK , unzip the downloaded package and start the standalone.sh script, not that hard.

I want to run this as a service though. There is no one source that you can use to give you this script, so this is a mix of everything.

I profess that I am not the best bash script writer in the world, so if you use this as the basis for your script please post you improved script so that everyone can benefit.

For the benefit of the Google search engine I will tag this post with how I would want to find this informative piece of documentation 🙂  “create Infinispan linux startup script”

Anyway here this the code :-

 

#!/bin/bash
#
# chkconfig: 35 90 12
# description: infinispan start script
#
# Get function from functions library
. /etc/init.d/functions
LockFile=/var/lock/subsys/infinispan

# Start the service infinispan server
start() {
if [ -f $LockFile ];
 then
 echo "Infinispan already running"
 else
cd /opt/infinispan/bin/
 ./standalone.sh -c standalone.xml > /dev/null 2>&1 &
### Create the lock file ###
 touch $LockFile
 fi
echo "infinispan server startup"
}
# Restart the service FOO
stop() {
 netstat -tupl | grep memcache | awk {'print $7'} | sed 's/[^0-9]//g' | xargs kill -9 > /dev/null 2>&1 &
 ### Now, delete the lock file ###
 rm -f $LockFile
 echo "infinispan server stopped"
}
### main logic ###
case "$1" in
 start)
 start
 ;;
 stop)
 stop
 ;;
 status)
 if [ -f $LockFile ];
 then
 echo "Infinispan running"
 else
 echo "Infinispan is not running"
 fi
 ;;
 restart|reload|condrestart)
 stop
 start
 ;;
 *)
 echo $"Usage: $0 {start|stop|restart|reload|status}"
 exit 1
esac
exit 0

 

 

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s