HEX
Server: Apache/2.4.34 (Red Hat) OpenSSL/1.0.2k-fips
System: Linux WORDPRESS 3.10.0-1160.118.1.el7.x86_64 #1 SMP Thu Apr 4 03:33:23 EDT 2024 x86_64
User: digital (1020)
PHP: 7.2.24
Disabled: NONE
Upload Files
File: //usr/openv/java/jbpSA
#! /bin/sh
# $Revision$
#
# $Copyright: Copyright (c) 2016 Veritas Technologies LLC. All rights reserved VT25-0977-2658-84-51-3 $
#
## Start the NetBackup-Java JBP Client as a standalone Java application.
#

## Set a sane umask
umask 022

PATH=/bin:/usr/bin:/usr/ucb:$PATH; export PATH
INSTALL_DIR=/usr/openv/java
INSTALL_PATH=$INSTALL_DIR
DOTNBJ_CONF=$INSTALL_PATH/.nbjConf
NBJ_CONF=$INSTALL_PATH/nbj.conf

OS=`uname -s`

if [ "$OS" = "Linux" ]
then
	unset POSIXLY_CORRECT
	ECHO="/bin/echo -e"
else
	ECHO="/usr/bin/echo"
fi

## Read the default configuration variables for current version GUI.
. $DOTNBJ_CONF

DEBUG_PROPERTIES=$INSTALL_PATH/Debug.properties

## Set default values for INITIAL_MEMORY and MAX_MEMORY.
INITIAL_MEMORY=36M
MAX_MEMORY=256M
## Get the values for INITIAL_MEMORY and MAX_MEMORY from conf file.
## Assume the last uncommented one of each in the file is the one to use.
line=`cat $NBJ_CONF | egrep -v "^#" | egrep -i "INITIAL_MEMORY" | tail -1`
if [ "$line" != "" ] ; then
	INITIAL_MEMORY=`echo $line | cut -d= -f2 | awk '{print $1}'`
fi
line=`cat $NBJ_CONF | egrep -v "^#" | egrep -i "MAX_MEMORY" | tail -1`
if [ "$line" != "" ] ; then
	MAX_MEMORY=`echo $line | cut -d= -f2 | awk '{print $1}'`
fi
export INITIAL_MEMORY
export MAX_MEMORY

LOG_CMDLINES=false
LOGIN_HOST=""
PLAT64FLAG=""
LOG_FILE=""
RELEASE_VERSION="8.0"
INITMEM=""
MAXMEM=""
CMD_OPTIONS="$@"
PREF_FACTORY=""

while [ "`$ECHO $1 | cut -c1`" = "-" ]
do
  case "$1" in
    -d | -display)
        DISPLAY=$2;export DISPLAY; shift 2;;
    -D) 
        DEBUG_PROPERTIES=$2;export DEBUG_PROPERTIES; shift 2;;
    -h)
        $ECHO "\nUsage: $0 [option]\n"
        $ECHO "  option:"
        $ECHO "  -d  Hostname to display to, e.g., 'eagle:0.0'."
        $ECHO "  -D  Debug properties file."
        $ECHO "  -h  Help."
        $ECHO "  -H  Hostname to login to, e.g., 'eagle'."
        $ECHO "  -l  Full path of log file."
        $ECHO "  -lc Log cmdlines used by the application to the log file."
        $ECHO "  -ms Initial Java VM memory."
        $ECHO "  -mx Maximum Java VM memory."
        $ECHO "  -r  Version of the console to use, either '7.0' or '7.1' or '7.5' or '7.6' or '7.6.1' or '7.7' or '7.7.1' or '7.7.2' or '7.7.3'"
        exit 2;;
    -H)
        LOGIN_HOST=$2;export LOGIN_HOST; shift 2;;
    -l)
        LOG_FILE=$2;export LOG_FILE; shift 2;;
    -lc)
        LOG_CMDLINES=true;export LOG_CMDLINES; shift 1;;
    -ms)
        INITMEM=$2;export INITMEM; shift 2;;
    -mx)
        MAXMEM=$2;export MAXMEM; shift 2;;
    -r)
	if [ $# -lt 2 ];then
		$ECHO "\nUsage: $0 -r  Version of the console to use, either '7.0' or '7.1' or '7.5' or '7.6' or '7.6.1' or '7.7' or '7.7.1' or '7.7.2' or '7.7.3'"
		exit 22
	fi
        RELEASE_VERSION=$2;export RELEASE_VERSION; shift 2;;
    *)
        $ECHO "\nUsage: $0 [option]\n"
        $ECHO "  option:"
        $ECHO "  -d  Hostname to display to, e.g., 'eagle:0.0'."
        $ECHO "  -D  Debug properties file."
        $ECHO "  -h  Help."
        $ECHO "  -H  Hostname to login to, e.g., 'eagle'."
        $ECHO "  -l  Full path of log file."
        $ECHO "  -lc Log cmdlines used by the application to the log file."
        $ECHO "  -ms Initial Java VM memory."
        $ECHO "  -mx Maximum Java VM memory."
        $ECHO "  -r  Version of the console to use, either '7.0' or '7.1' or '7.5' or '7.6' or '7.6.1' or '7.7' or '7.7.1' or '7.7.2' or '7.7.3'"
        exit 2;;
  esac
done

## Validate -r data.
if [ "$RELEASE_VERSION" != "7.0" ] && [ "$RELEASE_VERSION" != "7.1" ] && \
	[ "$RELEASE_VERSION" != "7.5" ] && [ "$RELEASE_VERSION" != "7.6" ] && \
	[ "$RELEASE_VERSION" != "7.6.1" ] && [ "$RELEASE_VERSION" != "7.7" ] && \
	[ "$RELEASE_VERSION" != "7.7.1" ] && [ "$RELEASE_VERSION" != "7.7.2" ] && \
	[ "$RELEASE_VERSION" != "7.7.3" ] && [ "$RELEASE_VERSION" != "8.0" ] ; then
	$ECHO "\n\n\tInvalid value, $RELEASE_VERSION, for the -r option - try again.\n"
	exit 1
fi

DOTNBJ_CONF=""
ERROR_LINE1=""

## Determine version of the GUI to startup by first checking the version
## of the host specified.  If errors or an unsupported version, do so based
## on the user specifying a release version (-r option).  Default to the
## current version if not specified.
if [ "$LOGIN_HOST" != "" ] ; then
	OUTPUT=`$INSTALL_PATH/../netbackup/bin/bpclntcmd -get_remote_host_version $LOGIN_HOST 2>&1`
	EXIT_STATUS=$?
	if [ "$EXIT_STATUS" != "0" ] ; then
		ERROR_LINE1="\nCould not get version of host $LOGIN_HOST - ERROR:"
		ERROR_LINE2="\t$OUTPUT (exit status = $EXIT_STATUS)."
		$ECHO "\n"$ERROR_LINE1
		$ECHO $ERROR_LINE2
	else
		VERSION=`$ECHO $OUTPUT | cut -d";" -f5`
		if [ "$VERSION" = "7.0" ] ; then
			DOTNBJ_CONF=$INSTALL_PATH/.nbjConf_70
			RELEASE_VERSION=7.0
		elif [ "$VERSION" = "7.1" ] ; then
			DOTNBJ_CONF=$INSTALL_PATH/.nbjConf_71
			RELEASE_VERSION=7.1
		elif [ "$VERSION" = "7.5" ] ; then
			DOTNBJ_CONF=$INSTALL_PATH/.nbjConf_75
			RELEASE_VERSION=7.5
		elif [ "$VERSION" = "7.6" ] ; then
			DOTNBJ_CONF=$INSTALL_PATH/.nbjConf_76
			RELEASE_VERSION=7.6
		elif [ "$VERSION" = "7.6.1" ] ; then
			DOTNBJ_CONF=$INSTALL_PATH/.nbjConf_761
			RELEASE_VERSION=7.6.1
		elif [ "$VERSION" = "7.7" ] ; then
			DOTNBJ_CONF=$INSTALL_PATH/.nbjConf_77
			RELEASE_VERSION=7.7
		elif [ "$VERSION" = "7.7.1" ] ; then
			DOTNBJ_CONF=$INSTALL_PATH/.nbjConf_771
			RELEASE_VERSION=7.7.1
		elif [ "$VERSION" = "7.7.2" ] ; then
			DOTNBJ_CONF=$INSTALL_PATH/.nbjConf_772
			RELEASE_VERSION=7.7.2
		elif [ "$VERSION" = "7.7.3" ] ; then
			DOTNBJ_CONF=$INSTALL_PATH/.nbjConf_773
			RELEASE_VERSION=7.7.3
		elif [ "$VERSION" = "8.0" ] ; then
			DOTNBJ_CONF=$INSTALL_PATH/.nbjConf
			RELEASE_VERSION="8.0"
		else
			ERROR_LINE1="\n\tAdministration of server, $LOGIN_HOST, is not"
			ERROR_LINE2="\tpossible due to its unsupported version, $VERSION."
			$ECHO $ERROR_LINE1
			$ECHO $ERROR_LINE2
		fi
	fi
fi

if [ "$DOTNBJ_CONF" = "" ] ; then
	# Start the version user possibly specified.
	if [ "$RELEASE_VERSION" = "7.0" ] ; then
		DOTNBJ_CONF=$INSTALL_PATH/.nbjConf_70
	elif [ "$RELEASE_VERSION" = "7.1" ] ; then
		DOTNBJ_CONF=$INSTALL_PATH/.nbjConf_71
	elif [ "$RELEASE_VERSION" = "7.5" ] ; then
		DOTNBJ_CONF=$INSTALL_PATH/.nbjConf_75
	elif [ "$RELEASE_VERSION" = "7.6" ] ; then
		DOTNBJ_CONF=$INSTALL_PATH/.nbjConf_76
	elif [ "$RELEASE_VERSION" = "7.6.1" ] ; then
		DOTNBJ_CONF=$INSTALL_PATH/.nbjConf_761
	elif [ "$RELEASE_VERSION" = "7.7" ] ; then
		DOTNBJ_CONF=$INSTALL_PATH/.nbjConf_77
	elif [ "$RELEASE_VERSION" = "7.7.1" ] ; then
		DOTNBJ_CONF=$INSTALL_PATH/.nbjConf_771
	elif [ "$RELEASE_VERSION" = "7.7.2" ] ; then
		DOTNBJ_CONF=$INSTALL_PATH/.nbjConf_772
	elif [ "$RELEASE_VERSION" = "7.7.3" ] ; then
		DOTNBJ_CONF=$INSTALL_PATH/.nbjConf_773
	elif [ "$RELEASE_VERSION" = "8.0" ] ; then
		DOTNBJ_CONF=$INSTALL_PATH/.nbjConf
	fi
fi
if [ "$DOTNBJ_CONF" != "" ] && [ "$DOTNBJ_CONF" != "$INSTALL_PATH/.nbjConf" ]
then
	## Read the configuration variables for the backlevel version.
	## Current version was defaulted above.
	. $DOTNBJ_CONF
fi

## Set log file path if user specified on the cmdline or had JNB_LOG env var.
if [ "$LOG_FILE" = "" ] ; then
	if [ "$JBP_LOG" = "" ] ; then
		LOG_FILE=$NBJAVA_LOGS_PATH/jbp.`whoami`.jbpSA.$$.log
	else
		LOG_FILE=$JBP_LOG
	fi
	if [ -h "$LOG_FILE" ] ; then
		rm -fr $LOG_FILE
	fi
fi

## Set memory options if user specified on the cmdline.
if [ "$INITMEM" != "" ] ; then
	INITIAL_MEMORY=$INITMEM; export INITIAL_MEMORY
fi
if [ "$MAXMEM" != "" ] ; then
	MAX_MEMORY=$MAXMEM; export MAX_MEMORY
fi

# The following is needed to prevent Java from exceeding the default open
# file limit because it does not close image files fast enough.
ulimit -n 1024

case "$OS" in
	OSF1)
		LD_LIBRARY_PATH=$VRTS_LIBRARY_PATH:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH;;
	AIX)
		LIBPATH=$VRTS_LIBRARY_PATH:$LIBPATH; export LIBPATH;;
	HP-UX)
		SHLIB_PATH=$VRTS_LIBRARY_PATH:$SHLIB_PATH; export SHLIB_PATH;
		PLAT64FLAG="-d64"
		;;
	Linux)
		LD_LIBRARY_PATH=$VRTS_LIBRARY_PATH:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
		PLAT64FLAG="-d64"
		;;
	SunOS)
		PLAT64FLAG="-d64"
		# On Solaris, due to a bug fix made by Sun for release levels after 
		# 5.6, if the locale is currently C/POSIX it needs to be set to 
		# ISO 8859-1 in order to display extended characters.
		# NB does not get installed on anything older than Solaris 10
		# so no need to check release level
		if [ "$LC_ALL" = "" ] ; then
			eval LC_ALL="$LANG" >> /dev/null 2>&1
			export LC_ALL
		fi
		if [ "$LC_ALL" = "C" ] || [ "$LC_ALL" = "" ] ; then
			eval LC_ALL=iso_8859_1 >> /dev/null 2>&1
			export LC_ALL
			eval LANG=iso_8859_1 >> /dev/null 2>&1
			export LANG
		fi

		# On Solaris, LD_LIBRARY_PATH must be set for access to libX11 - default
		# it to /usr/openwin/lib.  If it doesn't exist, inform the user and quit.
		if [ -d /usr/openwin/lib ]
		then
			LD_LIBRARY_PATH=/usr/openwin/lib:$VRTS_LIBRARY_PATH:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH;
		else
			$ECHO "\n\tDirectory /usr/openwin/lib doesn't exist.  It is the default"
			$ECHO "\tlocation for libX11.so.4 which is required by NB-Java."
			$ECHO "\tPlease create the /usr/openwin/lib directory and a symbolic"
			$ECHO "\tlink to libX11.so.4 or modify this script to properly set the"
			$ECHO "\tLD_LIBRARY_PATH environment variable.\n"
			exit 1
		fi;;
esac

CLASSPATH=$PJAR:$COMMONJAR:$DBEXTJAR:$JBPJAR:$NBJAR:$PV_JAR:$KL_JAR:$HELPVIEWER_JAR:$VXSSIOP_JAR:$ATWRAPPER_JAR:$JDOM_JAR:$CRIMSON_JAR:.:$INSTALL_PATH; export CLASSPATH

XENVIRONMENT=$INSTALL_PATH/Xenv;export XENVIRONMENT

if [ "$RELEASE_VERSION" = "7.0" ] || [ "$RELEASE_VERSION" = "7.1" ] || [ "$RELEASE_VERSION" = "7.5" ] || [ "$RELEASE_VERSION" = "7.6" ] || [ "$RELEASE_VERSION" = "7.6.1" ] || [ "$RELEASE_VERSION" = "7.7" ] || [ "$RELEASE_VERSION" = "7.7.1" ] || [ "$RELEASE_VERSION" = "7.7.2" ] || [ "$RELEASE_VERSION" = "7.7.3" ] || [ "$RELEASE_VERSION" = "8.0" ]; then
	PREF_FACTORY="-Djava.util.prefs.PreferencesFactory=vrts.common.launch.PropertiesPreferencesFactory"
fi

if [ "$LOG_FILE" != "" ]
then
	$ECHO "\nDISPLAY environment variable is set to: $DISPLAY" > $LOG_FILE
	$ECHO "Console was started on:" >> $LOG_FILE
	$ECHO "\t`uname -a`\n" >> $LOG_FILE
	$ECHO "Command line options were:" >> $LOG_FILE
	$ECHO "\t"$0 $CMD_OPTIONS >> $LOG_FILE
	if [ "$ERROR_LINE1" != "" ] ; then
		$ECHO $ERROR_LINE1 >> $LOG_FILE
		$ECHO $ERROR_LINE2 >> $LOG_FILE
	fi
	$ECHO "\nStarting user console version $RELEASE_VERSION.\n" >> $LOG_FILE
	$ECHO "\n\tStarting user console version $RELEASE_VERSION."
	$ECHO "\tThe log file for this execution instance is\n\t$LOG_FILE\n"
fi

locale >> $LOG_FILE 2>&1
$ECHO "" >> $LOG_FILE
lcCtypeLine=`locale | grep LC_CTYPE`
LCCTYPE=`echo $lcCtypeLine | cut -d= -f2`

# The ordering of parameters here is important.  In particular, the 
# -Dvrts.NBJAVA_CONF parameter must be first.  bpps and bp.kill_all are 
# using this to distinguish NBJava processes from NBAR and VSM java processes.

$JAVA_PATH -Dvrts.NBJAVA_CONF=$NBJ_CONF -showversion $PLAT64FLAG -Dvrts.common.server.LCCTYPE=${LCCTYPE} -Dvrts.common.server.LOG_CMDLINES=${LOG_CMDLINES} -Djava.library.path=${VRTS_LIBRARY_PATH} -Dvrtsat.datadir=${EAT_DATA_DIR} -Dvrtsat.home=${NB_EAT_HOME_DIR} -Dvrts.common.utilities.DEBUG_PROPERTIES=$DEBUG_PROPERTIES -Dvrts.nbe.HOSTNAME=$LOGIN_HOST -Dvrts.nbe.INST_REL=$INSTALLED_RELEASE -Dvrts.nbe.BUILDNO=$BUILDNUMBER $PREF_FACTORY -Xms$INITIAL_MEMORY -Xmx$MAX_MEMORY vrts.nbe.UserConsole >> $LOG_FILE 2>&1

if [ $? != "0" ] && [ -s $LOG_FILE ]
then
	cat $LOG_FILE
fi

## The end ...