#!/bin/ksh
usage()
{
# print error to the stderr
print "Usage: ${0} { inc_non_primary }" >&2
print "Usage: ${table_name} ${ c}" >&2
}
####
# maybe your functions include also options_count handling ? - change order
# or next line include error => script will exit, usually never set output redirect when use
# .
#. /opt/projects/gsd/scripts/functions gsd > /dev/null 2>&1
# maybe you try to load file gsd ?
# better method to load something to this process
f=/opt/projects/gsd/scripts/functions/gsd
[ -f "$f" ] && . $f || print "no $f" >&2
option_count=$#
[ "$option_count" -gt 2 ] && usage && exit 1
[ "$option_count" -lt 1 ] && usage && exit 1
#CURR_USER: where set ? Usually LOGNAME
if [ "$CURR_USER" != "srvcdesk" ]; then
log_msg "You must be srvcdesk to execute this script, ABORTING!"
exit 5
fi
# make default, you can use { }, but not needed in your cases
ACTION_TYPE="$1"
if [ "$option_count" = 2 ] # both are possible: string = and numeric -eq,
then
TABLE_NAME="$1"
ACTION_TYPE="$2"
print "$ACTION_TYPE"
print "$TABLE_NAME"
fi
APPLNAME="DBCheckSum"
LOGFILE="$NIGHTLY_LOG_DIR/$APPLNAME.$DATETIME_STAMP.log"
ERROR_LOGFILE="$NIGHTLY_LOG_DIR/$APPLNAME.$DATETIME_STAMP.err"
case "$option_count" in
1) java -Xms256m -Xmx1536m "$APPLNAME" "$ACTION_TYPE" > "$LOGFILE" 2> "$ERROR_LOGFILE"
;;
2) java -Xms256m -Xmx1536m "$APPLNAME" "$TABLE_NAME" "$ACTION_TYPE" > "$LOGFILE" 2> "$ERROR_LOGFILE"
;;
esac
Thanks to Moumou & kshji !! the script worked both the ways. the problem was with the include functions file. I changed the order of it and got it a little lower just above