Status-Checking Script for DirXML Remote Loader



By: aanthonisse

October 29, 2007 6:00 am

Reads: 322

Comments:0

Rating:0

Problem:

I installed DirXML Remote Loader using the script from http://www.novell.com/coolsolutions/feature/16975.html

With this script it is not possible to see easily if the DirXML Remote Loader is started or not.

It can be done with ps -ef |grep dirxml, but that will fill up the screen with a lot of Java classes.

Solution:

I added a section to the script to make status checking possible, like every decent script should have.

Example:

This example is for a SAP DirXML driver. The variables DIRXML_HOME, DIRXML_CONF, REMOTELOADER, REMOTELOADERPASSWD and DRIVERPASSWD are probably different on your system, double check this before using the script on a production system.

# -- [ Remote loader startup and shutdown  script ] --
### BEGIN INIT INFO
# Provides: novell-remoteloader
# Description:    Start DirXML Remote Loader
### END INIT INFO


DIRXML_HOME="/usr/lib/dirxml"
DIRXML_CONF="/opt/novell/dirxml/configsapum.txt"
REMOTELOADER="/usr/bin/dirxml_jremote"
REMOTELOADERPASSWD=""
DRIVERPASSWD=""
PIDFILE="/var/run/remoteloader.pid"

case "$1" in

       "start" )
               /bin/echo -n "Setting up DirXML Remote Loader..."
               cd $DIRXML_HOME
               $REMOTELOADER -config $DIRXML_CONF -sp $REMOTELOADERPASSWD $DRIVERPASSWD
               /bin/echo -n "Starting the DirXML Remote Loader..."
               $REMOTELOADER -config $DIRXML_CONF &
               sleep 1s
               # This is probably not the best way to get the PID, but it certainly works. Change 8001 to whatever the local listening port is.
               netstat -plant | grep LIST | grep java | grep 8001 |awk '{print $7}' | awk -F "/" '{print $1}' > $PIDFILE
               echo "done"
       ;;

       "stop" )
               /bin/echo -n "Stopping the DirXML Remote Loader..."
               /bin/kill `cat $PIDFILE`
               rm -f $PIDFILE
               /bin/echo "done"
       ;;

       "status" )
              PRG_PID=`cat $PIDFILE`
              if [ "$PRG_PID" ]; then
                  echo "DirXML Remote Loader is running with pid $PRG_PID"
                  exit 0
              else
                  echo "DirXML Remote Loader is not running"
                  exit 1
              fi
       ;;

       * )
               /bin/echo "Usage: /etc/init.d/novell-remoteloader {start|stop|status}"
               exit 1
       ;;
esac

exit 0

Environment:

The script should work on almost every Linux version, as long as you use bash shell.

Tested on Linux 2.6.5-7.286-smp, SLES9 SP3 AMD64

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Tags: ,
Categories: Identity Manager, Technical Solutions

Disclaimer: As with everything else at NetIQ Cool Solutions, this content is definitely not supported by NetIQ, so Customer Support will not be able to help you if it has any adverse effect on your environment.  It just worked for at least one person, and perhaps it will be useful for you too.  Be sure to test in a non-production environment.

Comment