Replace `` with $()

This commit is contained in:
Jeremy Gardais 2020-06-05 15:30:53 +02:00
parent a4a6ba597f
commit 6b20157c56
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 23 additions and 24 deletions

View File

@ -141,7 +141,7 @@ get_status()
### Check the jobs ### Check the jobs
### ###
get_header "Jobs" "$QSTAT -l hostname=$MACHINEDOTS" get_header "Jobs" "$QSTAT -l hostname=$MACHINEDOTS"
jobs=`${QSTAT} -l hostname=${MACHINEDOTS} -s r` jobs=$(${QSTAT} -l hostname=${MACHINEDOTS} -s r)
if [ -z "$jobs" ]; then if [ -z "$jobs" ]; then
echo "No Running Jobs" echo "No Running Jobs"
else else
@ -167,40 +167,40 @@ get_status()
### Check queue instance states ### Check queue instance states
### ###
queueTriggered=false; queueTriggered=false;
# Queueset=`${QHOST} -h ${MACHINEDOTS} -q | ${TAIL} +5 | ${AWK} '{ print $1 }'` # Queueset=$(${QHOST} -h ${MACHINEDOTS} -q | ${TAIL} +5 | ${AWK} '{ print $1 }')
${QHOST} -h ${MACHINEDOTS} -q | ${TAIL} +5 > "${PLUGIN_RESULT}.QSTATE" ${QHOST} -h ${MACHINEDOTS} -q | ${TAIL} +5 > "${PLUGIN_RESULT}.QSTATE"
Queueset=`cat "${PLUGIN_RESULT}.QSTATE" | ${AWK} '{ print $1 }'` Queueset=$(cat "${PLUGIN_RESULT}.QSTATE" | ${AWK} '{ print $1 }')
for Qset in $Queueset; do for Qset in $Queueset; do
# qstate=`${QHOST} -q -h ${MACHINEDOTS} | ${TAIL} +5 | $GREP " $Qset" | $AWK '{print $4}'` # qstate=$(${QHOST} -q -h ${MACHINEDOTS} | ${TAIL} +5 | $GREP " $Qset" | $AWK '{print $4}')
qstate=`cat "${PLUGIN_RESULT}.QSTATE" | $GREP " $Qset" | $AWK '{print $4}'` qstate=$(cat "${PLUGIN_RESULT}.QSTATE" | $GREP " $Qset" | $AWK '{print $4}')
# Order determines more significant color status # Order determines more significant color status
if [ "`echo $qstate | $GREP -c d`" != "0" ]; then if [ "$(echo "${qstate}" | $GREP -c d)" != "0" ]; then
COLOR="clear" COLOR="clear"
queueMsg=`echo "$queueMsg<BR>$CLEAR_PIC $Qset@$HOST is DISABLED"` queueMsg=$(echo "$queueMsg<BR>$CLEAR_PIC $Qset@$HOST is DISABLED")
queueTriggered=true; queueTriggered=true;
elif [ "`echo $qstate | $GREP -c E`" != "0" ]; then elif [ "$(echo "${qstate}" | $GREP -c E)" != "0" ]; then
COLOR="red" COLOR="red"
queueMsg=`echo "$queueMsg<BR>$RED_PIC $Qset@$HOST is in ERROR!"` queueMsg=$(echo "$queueMsg<BR>$RED_PIC $Qset@$HOST is in ERROR!")
queueTriggered=true; queueTriggered=true;
elif [ "`echo $qstate | $GREP -c c`" != "0" ]; then elif [ "$(echo "${qstate}" | $GREP -c c)" != "0" ]; then
COLOR="yellow" COLOR="yellow"
queueMsg=`echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST has an ambigious configuration!"` queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST has an ambigious configuration!")
queueTriggered=true; queueTriggered=true;
elif [ "`echo $qstate | $GREP -c a`" != "0" ] || \ elif [ "$(echo "${qstate}" | $GREP -c a)" != "0" ] || \
[ "`echo $qstate | $GREP -c A`" != "0" ]; then [ "$(echo "${qstate}" | $GREP -c A)" != "0" ]; then
queueMsg=`echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST is in ALARM"` queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST is in ALARM")
elif [ "`echo $qstate | $GREP -c s`" != "0" ] || \ elif [ "$(echo "${qstate}" | $GREP -c s)" != "0" ] || \
[ "`echo $qstate | $GREP -c S`" != "0" ]; then [ "$(echo "${qstate}" | $GREP -c S)" != "0" ]; then
queueMsg=`echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST is SUSPENDED"` queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST is SUSPENDED")
elif [ "`echo $qstate | $GREP -c u`" != "0" ]; then elif [ "$(echo "${qstate}" | $GREP -c u)" != "0" ]; then
COLOR="yellow" COLOR="yellow"
queueMsg=`echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST is UNAVAILABLE!"` queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST is UNAVAILABLE!")
queueTriggered=true; queueTriggered=true;
elif [ "$qstate" = "" ]; then elif [ "$qstate" = "" ]; then
queueMsg=`echo "$queueMsg<BR>$GREEN_PIC $Qset@$HOST is OK"` queueMsg=$(echo "$queueMsg<BR>$GREEN_PIC $Qset@$HOST is OK")
else else
queueMsg=`echo "$queueMsg<BR>$UNKNOWN_PIC $Qset@$HOST is UNKNOWN"` queueMsg=$(echo "$queueMsg<BR>$UNKNOWN_PIC $Qset@$HOST is UNKNOWN")
queueTriggered=true; queueTriggered=true;
fi fi
done done
@ -229,10 +229,9 @@ get_status()
get_status > "${PLUGIN_RESULT}" get_status > "${PLUGIN_RESULT}"
# NOW USE THE XYMON COMMAND TO SEND THE DATA ACROSS # NOW USE THE XYMON COMMAND TO SEND THE DATA ACROSS
$XYMON "${XYMONSRV}" "status ${MACHINE}.${TEST} ${COLOR} `$DATE` `cat ${PLUGIN_RESULT}`" $XYMON "${XYMONSRV}" "status ${MACHINE}.${TEST} ${COLOR} $($DATE) $(cat ${PLUGIN_RESULT})"
#For testing only #For testing only
# echo $XYMON "${XYMONSRV}" "status ${MACHINE}.${TEST} ${COLOR} `$DATE` `cat ${PLUGIN_RESULT}`" > /tmp/sgetmp # echo $XYMON "${XYMONSRV}" "status ${MACHINE}.${TEST} ${COLOR} $($DATE) $(cat ${PLUGIN_RESULT})" > /tmp/sgetmp
# Clean up our mess # Clean up our mess
# Checking for existence of each file since the whole test may be optional # Checking for existence of each file since the whole test may be optional