Former-commit-id:133dc97f67
[formerlya02aeb236c
] [formerly9f19e3f712
] [formerly06a8b51d6d
[formerly9f19e3f712
[formerly 64fa9254b946eae7e61bbc3f513b7c3696c4f54f]]] Former-commit-id:06a8b51d6d
Former-commit-id:377dcd10b9
[formerly3360eb6c5f
] Former-commit-id:8e80217e59
106 lines
2.5 KiB
Bash
106 lines
2.5 KiB
Bash
#!/bin/bash
|
|
|
|
# Alert VIZ Startup Script
|
|
# Note: Alert VIZ will not run as 'root'
|
|
|
|
user=`/usr/bin/whoami`
|
|
if [ ${user} == 'root' ]; then
|
|
echo "WARNING: Alert VIZ cannot be run as user '${user}'!"
|
|
echo " change to another user and run again."
|
|
exit 1
|
|
fi
|
|
|
|
# We will no longer be using hard-coded paths that need to be replaced.
|
|
# Use rpm to find the paths that we need.
|
|
JAVA_INSTALL="/awips2/java"
|
|
RC="$?"
|
|
if [ ! "${RC}" = "0" ]; then
|
|
echo "ERROR: awips2-java Must Be Installed."
|
|
echo "Unable To Continue ... Terminating."
|
|
exit 1
|
|
fi
|
|
PYTHON_INSTALL="/awips2/python"
|
|
RC="$?"
|
|
if [ ! "${RC}" = "0" ]; then
|
|
echo "ERROR: awips2-python Must Be Installed."
|
|
echo "Unable To Continue ... Terminating."
|
|
exit 1
|
|
fi
|
|
ALERTVIZ_INSTALL="/awips2/alertviz"
|
|
|
|
path_to_script=`readlink -f $0`
|
|
dir=$(dirname $path_to_script)
|
|
|
|
export AWIPS_INSTALL_DIR=${ALERTVIZ_INSTALL}
|
|
|
|
export LD_LIBRARY_PATH=${JAVA_INSTALL}/lib:${PYTHON_INSTALL}/lib:$LD_LIBRARY_PATH
|
|
export LD_PRELOAD=${PYTHON_INSTALL}/lib/libpython2.7.so
|
|
export PATH=${JAVA_INSTALL}/bin:${PYTHON_INSTALL}/bin:$PATH
|
|
export JAVA_HOME="${JAVA_INSTALL}/jre"
|
|
|
|
exitVal=1
|
|
|
|
#check for gtk-2.0 value
|
|
gtkResource=.gtkrc-2.0
|
|
includeLine="include \"$HOME/.gtkrc.mine\""
|
|
mineFile=.gtkrc.mine
|
|
altButtonLine="gtk-alternative-button-order=1"
|
|
if [ -f $HOME/$gtkResource ]; then
|
|
if [ -w $HOME/$gtkResource ]; then
|
|
var=`grep "gtkrc.mine" $HOME/$gtkResource`
|
|
if [ '' == "$var" ]; then
|
|
echo $includeLine >> $HOME/$gtkResource
|
|
fi
|
|
fi
|
|
else
|
|
touch $HOME/$gtkResource
|
|
echo $includeLine >> $HOME/$gtkResource
|
|
fi
|
|
|
|
if [ -f $HOME/$mineFile ]; then
|
|
if [ -w $HOME/$mineFile ]; then
|
|
var=`grep "alternative-button-order" $HOME/$mineFile`
|
|
if [ '' == "$var" ]; then
|
|
echo $altButtonLine >> $HOME/$mineFile
|
|
fi
|
|
fi
|
|
else
|
|
touch $HOME/$mineFile
|
|
echo $altButtonLine >> $HOME/$mineFile
|
|
fi
|
|
|
|
|
|
#check for the logs directory, which may not be present at first start
|
|
hostName=`hostname -s`
|
|
LOGDIR=$HOME/caveData/logs/consoleLogs/$hostName/
|
|
|
|
if [ ! -d $LOGDIR ]; then
|
|
mkdir -p $LOGDIR
|
|
fi
|
|
|
|
#run a loop for alertviz
|
|
while [ $exitVal -ne 0 ]
|
|
do
|
|
curTime=`date +%Y%m%d_%H%M%S`
|
|
LOGFILE=${LOGDIR}/alertviz_${curTime}.log
|
|
|
|
#first check if we can write to the directory
|
|
if [ -w ${LOGDIR} ]; then
|
|
touch ${LOGFILE}
|
|
fi
|
|
|
|
#check for display; if no display then exit
|
|
if [ -z "${DISPLAY}" ]; then
|
|
echo "Display is not available."
|
|
exitVal=0
|
|
else
|
|
#finally check if we can write to the file
|
|
if [ -w ${LOGFILE} ]; then
|
|
${dir}/alertviz $* > ${LOGFILE} 2>&1
|
|
else
|
|
${dir}/alertviz $*
|
|
fi
|
|
fi
|
|
exitVal=$?
|
|
done
|
|
|