All pastes #452860 Raw Edit

Mine

public text v1 · immutable
·published 2007-04-22 15:58 UTC
rendered paste body
#!/bin/bash
export JAVA_HOME=/usr/lib/jvm/sun-java-1.5.0_10
export ANT_HOME=/usr/lib/ant
export GLOBUS_LOCATION=/usr/local/globus4.0.4

deploy=/usr/local/globus-4.0.4/bin/globus-deploy-gar
undeploy=/usr/local/globus-4.0.4/bin/globus-undeploy-gar
# Use at least enough arguments to ensure a valid type and action, or error out.
if [ $# -lt 2 ]; then
    echo "not enough arguments: $0 $*" >&2
    exit 1
fi

# Initialize type and action to leave the remaining args as the filelist.
type="$1"
shift
action="$1"
shift

# Use case type to ensure that the taghandler is passed only types it can
# handle.  In this case, use only handle files and error out on anything
# else
case "$type" in
    files)
        # For file type operations, case the possible actions and error
        # for anything unsupported.
        case "$action" in
            update)
                # Iterate the file list because it is not known in advance
                # how many files we will be passed in a given operation.
                running=0;
                if [ -f $GLOBUS_LOCATION/var/container.pid ]; then
	 	   echo "Stopping GT4 Container" 
                   running=1;
		   /usr/local/globus-4.0.4/bin/globus-stop-container-detached
		fi

		for file in $@; do
                   garid=$(echo $file | sed -e 's/.gar//') 
                   if [ -d $GLOBUS_LOCATION/etc/globus_packages/$garid ]; then
                   echo "Packaged already deployed! Undeploying first!"
		   $undeploy $garid
		   fi
                   $deploy $file
                done
                  if [ $running -ne 0 ]; then
		  /usr/local/globus-4.0.4/bin/globus-start-container-detached -nosec
                  fi
                ;;
            # Use preremove to cleanly stop a service
            # before removing the init file which controls it.
            remove)
                if [ -f $GLOBUS_LOCATION/var/container.pid ]; then
	 	   echo "Stopping GT4 Container" 
		   /usr/local/globus-4.0.4/bin/globus-stop-container-detached
		fi

		for file in $@; do
                   garid=$(echo $file | sed -e 's/.gar//') 
                   if [ -d $GLOBUS_LOCATION/etc/globus_packages/$garid ]; then
		   $undeploy $garid
		   fi
                done
                ;;
            *)
                echo "ERROR: taghandler $0 invoked for an action ($action) that is not handled" 1>&2
                exit 1
                ;;
        esac
        ;;
    *)
        echo "ERROR: taghandler $0 invoked for a type ($type) that is not handled" 1>&2
        exit 1
        ;;
esac

exit 0