Merge "Omaha #3675 alertviz cleanly exits when killed by signal" into omaha_14.4.1
Former-commit-id:26e4c16da4
[formerlyed2bd7a261
[formerly 5977e37b7368487867aca1cfdd362943633f92eb]] Former-commit-id:ed2bd7a261
Former-commit-id:db0e85e501
This commit is contained in:
commit
fddf14712a
1 changed files with 46 additions and 3 deletions
|
@ -3,6 +3,31 @@
|
||||||
# Alert VIZ Startup Script
|
# Alert VIZ Startup Script
|
||||||
# Note: Alert VIZ will not run as 'root'
|
# Note: Alert VIZ will not run as 'root'
|
||||||
|
|
||||||
|
# This software was developed and / or modified by Raytheon Company,
|
||||||
|
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
#
|
||||||
|
# U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
# This software product contains export-restricted data whose
|
||||||
|
# export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
# to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
# an export license or other authorization.
|
||||||
|
#
|
||||||
|
# Contractor Name: Raytheon Company
|
||||||
|
# Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
# Mail Stop B8
|
||||||
|
# Omaha, NE 68106
|
||||||
|
# 402.291.0100
|
||||||
|
#
|
||||||
|
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
# further licensing information.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# SOFTWARE HISTORY
|
||||||
|
# Date Ticket# Engineer Description
|
||||||
|
# ------------ ---------- ----------- --------------------------
|
||||||
|
# Oct 09, 2014 #3675 bclement added cleanExit signal trap
|
||||||
|
#
|
||||||
|
|
||||||
user=`/usr/bin/whoami`
|
user=`/usr/bin/whoami`
|
||||||
if [ ${user} == 'root' ]; then
|
if [ ${user} == 'root' ]; then
|
||||||
echo "WARNING: Alert VIZ cannot be run as user '${user}'!"
|
echo "WARNING: Alert VIZ cannot be run as user '${user}'!"
|
||||||
|
@ -78,6 +103,22 @@ if [ ! -d $LOGDIR ]; then
|
||||||
mkdir -p $LOGDIR
|
mkdir -p $LOGDIR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# takes in a process id
|
||||||
|
# kills spawned subprocesses of pid
|
||||||
|
# and then kills the process itself and exits
|
||||||
|
function cleanExit()
|
||||||
|
{
|
||||||
|
pid=$1
|
||||||
|
if [[ -n $pid ]]
|
||||||
|
then
|
||||||
|
pkill -P $pid
|
||||||
|
kill $pid
|
||||||
|
fi
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
trap 'cleanExit $pid' SIGHUP SIGINT SIGQUIT SIGTERM
|
||||||
|
|
||||||
#run a loop for alertviz
|
#run a loop for alertviz
|
||||||
count=0
|
count=0
|
||||||
while [ $exitVal -ne 0 -a $count -lt 10 ]
|
while [ $exitVal -ne 0 -a $count -lt 10 ]
|
||||||
|
@ -99,11 +140,13 @@ do
|
||||||
else
|
else
|
||||||
#finally check if we can write to the file
|
#finally check if we can write to the file
|
||||||
if [ -w ${LOGFILE} ]; then
|
if [ -w ${LOGFILE} ]; then
|
||||||
${dir}/alertviz $* > ${LOGFILE} 2>&1
|
${dir}/alertviz $* > ${LOGFILE} 2>&1 &
|
||||||
else
|
else
|
||||||
${dir}/alertviz $*
|
${dir}/alertviz $* &
|
||||||
fi
|
fi
|
||||||
|
pid=$!
|
||||||
|
wait $pid
|
||||||
|
exitVal=$?
|
||||||
fi
|
fi
|
||||||
exitVal=$?
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue