This is an example HTAR wrapper script that is used at Gleicher Enterprises.
#!/bin/bash
#
# *********************************************************************
# WARNING WARNING WARNING
# This script must NOT write to stdout as it could potentially corrupt
# data if htar is used in a pipeline!!! Any messages printed or echoed
# should do something like the following to write to stderr:
# echo "some message" 1>&2
# ********************************************************************
#
# Michael Gleicher
#
# Wrapper script for the HPSS Tar (HTAR) Utility
#
#set -v -x
# If a restricted port range is in effect, set it in the environment
# and tell the user
#echo "[RESTRICTED PORT RANGE IN EFFECT: 3000-3030]" 1>&2
#export HPSS_PFTPC_PORT_RANGE=ncacn_ip_tcp[3000-3030]
# Set the base path to the HSI configuration files.
# HSI_BASE_PATH is needed for the HPSS.conf, etc. files at
# Gleicher Enterprises.
# HPSS_CFG_FILE_PATH is used as the path prefix for the HPSS.conf
# file
HSI_BASE_PATH=/usr/local/apps/hsi
export HPSS_CFG_FILE_PATH=$HSI_BASE_PATH/etc
# Set the base path for the HTAR wrapper script and executables.
# At Gleicher Enterprises, the wrapper script ("htar")and executables
# ("htar.3.4.2.exe") live in /usr/local/apps/htar/bin.
# There is a symlink to the wrapper script from
# /usr/local/bin/htar -> /usr/local/apps/htar/bin/htar
# The wrapper script launches "htar.exe", which is a symbolic link
# to the current executable, such as "htar.3.4.2.exe". This makes
# it easy to switch between versions without having to change the
# wrapper script.
HTAR_BASE_PATH=/usr/local/apps/htar
######################################################################
# Default authentication method to use.
# This can be either "combo","keytab","kerberos","gsi" or "local".
# See the HSI web page for details.
######################################################################
if [ "$HPSS_AUTH_METHOD" = "" ]; then
export HPSS_AUTH_METHOD=kerberos
fi
######################################################################
# Default Kerberos realm if using kerberos authentication.
######################################################################
if [ "$DEFAULT_REALM" = "" ]; then
DEFAULT_REALM=SDSC.EDU
fi
######################################################################
# HPSS_PRINCIPAL to use for HTAR
# Note that this varies depending on auth method used
# so this setting must come AFTER HPSS_AUTH_METHOD is set
######################################################################
if [ "$HPSS_PRINCIPAL" = "" ]; then
if [ "$HPSS_AUTH_METHOD" = "kerberos" ]; then
export HPSS_PRINCIPAL=`whoami`$DEFAULT_REALM
else
export HPSS_PRINCIPAL=`whoami`
fi
fi
######################################################################
# Default executable
######################################################################
export HTAR_EXE="$HTAR_BASE_PATH/bin/htar.exe"
######################################################################
# Location of hpss-specific config files, such as HPSS.conf.
# At Gleicher Enterprises, this directory is used by both HSI and
# HTAR (/usr/local/apps/hsi/etc).
######################################################################
export HPSS_CFG_FILE_PATH="$HSI_BASE_PATH/etc"
######################################################################
# Set the location for the KERBEROS configuration file and version
# of kinit that is used to communicate with GEL's HPSS. This
# is only needed if the system's files are not to be used.
######################################################################
#export KRB5_CONFIG=$HSI_BASE_PATH/config/krb5.conf
#export KRB_KINIT=$HSI_BASE_PATH/bin/kinit
######################################################################
# Set the default port for the HSIGWD server
######################################################################
if [ "$HPSS_SERVER_PORT" = "" ]; then
# Set the port to 1217 for hsi 3.4.2
export HPSS_SERVER_PORT=1217
fi
######################################################################
# Set the default network interface to be used for inbound connections
# from the HPSS movers. Note that this can be overridden by the
# "PFTP Client Interfaces" section of the HPSS.conf file.
######################################################################
if [ "$HPSS_HOSTNAME" = "" ]; then
export HPSS_HOSTNAME=`hostname`
fi
######################################################################
# Make sure script does not expand wild cards meant for htar.
######################################################################
set -o noglob
######################################################################
# Launch the program
######################################################################
$HTAR_EXE "$@"
exit_status=$?
######################################################################
# If non-zero exit status other than EX_USAGE, tell user about it.
######################################################################
if [ "$exit_status" = "64" ] ; then
exit_status=0
fi
if [ "$exit_status" ] ; then
if [ $exit_status -ne 0 ] ; then
echo "###WARNING htar returned non-zero exit status." 1>&2
echo " $exit_status = $HTAR_EXE $@" 1>&2
fi
exit $exit_status
else
exit 0
fi