GlobusToolkit scripts

Three basic scripts for WS-GRAM, GSI-SSH and GridFTP that can make life with Globus Toolkit a bit easier.

WS-GRAM

#!/bin/bash

HOSTNAME=`hostname`
VERSION=4.2.1

if [ "$1" == "start" ]; then

   if [ "$USER" == "globus" ]; then
     export GLOBUS_LOCATION=/usr/local/globus-$VERSION/
     export LD_LIBRARY_PATH=/usr/local/globus-$VERSION/lib
     export GLOBUS_HOSTNAME=$HOSTNAME

     cd $GLOBUS_LOCATION
     ./bin/globus-start-container &
     PID=`ps aux | grep DGLOBUS | grep -v grep | awk {'print $2'}`
     echo "WS-GRAM started with PID $PID"
   else
     echo "Only globus user can start the WS-GRAM service"
     exit 1;
   fi

elif [ "$1" == "stop" ]; then

   if [ "$USERID" == "globus" ] || [ $UID -eq 0 ]; then
     PID=`ps aux | grep DGLOBUS | grep -v grep | awk {'print $2'}`
     kill -9 $PID
     echo "WS-GRAM stopped"
   else
     echo "Only user globus and root can stop WS-GRAM"
     exit 1;
   fi

fi

GSI-SSH

#!/bin/bash

HOSTNAME=`hostname`
VERSION=4.2.1

if [ "$1" == "start" ]; then

   if [ $UID -eq 0 ]; then
     export GLOBUS_LOCATION=/usr/local/globus-$VERSION/
     export LD_LIBRARY_PATH=/usr/local/globus-$VERSION/lib
     export GLOBUS_TCP_PORT_RANGE=20000,25000
     export GLOBUS_HOSTNAME=$HOSTNAME
     export GRID_SECURITY_DIR=/etc/grid-security/
     export X509_USER_KEY=/etc/grid-security/hostkey.pem
     export X509_USER_CERT=/etc/grid-security/hostcert.pem
     export X509_CERT_DIR=/etc/grid-security/certificates
     export GRIDMAP=/etc/grid-security/grid-mapfile

     $GLOBUS_LOCATION/sbin/sshd &
     PID=`ps u | grep $GLOBUS_LOCATION/sbin/sshd | grep -v grep | awk {'print $2 '}`
     echo "GSISSH started with PID $PID"
   else
     echo "Only root can start GSISSH service"
     exit 1;
   fi

elif [ "$1" == "stop" ]; then

   if [ $UID -eq 0 ]; then
     PID=`ps aux | grep globus | grep sshd | grep -v grep | awk {'print $2 '}`
     kill -9 $PID
     echo "GSISSH stopped"
   else
     echo "Only root can stop GSISSH"
     exit 1;
   fi

fi

GridFTP

#!/bin/bash

HOSTNAME=`hostname`
VERSION=4.2.1

if [ "$1" == "start" ]; then

   if [ $UID -eq 0 ]; then
     export GLOBUS_LOCATION=/usr/local/globus-$VERSION/
     export LD_LIBRARY_PATH=/usr/local/globus-$VERSION/lib
     export GLOBUS_TCP_PORT_RANGE=20000,25000
     export GLOBUS_HOSTNAME=$HOSTNAME
     export GRID_SECURITY_DIR=/etc/grid-security/
     export X509_USER_KEY=/etc/grid-security/hostkey.pem
     export X509_USER_CERT=/etc/grid-security/hostcert.pem
     export X509_CERT_DIR=/etc/grid-security/certificates
     export GRIDMAP=/etc/grid-security/grid-mapfile
     export GLOBUS_CALLBACK_POLLING_THREADS=1

     $GLOBUS_LOCATION/sbin/globus-gridftp-server -p 2811 -d 255 -l $GLOBUS_LOCATION/var/gridftp.log \
     -log-transfer $GLOBUS_LOCATION/var/gridftp-transfers.log -hostname $GLOBUS_HOSTNAME &
     PID=`ps aux | grep globus-gridftp-server | grep -v grep | awk {'print $2 '}`
     echo "GridFTP started with PID $PID"
   else
     echo "Only root can start GridFTP service"
     exit 1;
   fi

elif [ "$1" == "stop" ]; then

   if [ $UID -eq 0 ]; then
     PID=`ps aux | grep globus-gridftp-server | grep -v grep | awk {'print $2 '}`
     kill -9 $PID
     echo "GridFTP stopped"
   else
     echo "Only root can stop GridFTP"
     exit 1;
   fi

fi

You could of course combine them all together in a single script but I’d rather prefer to keep them separate and “clean”, executing them depending on what services need to run/stop.

Leave a Reply

Please log in using one of these methods to post your comment:

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