In previous versions, the code did this:
if [[ -n "$NHC_DETACHED" ]]; then
echo "$RET $*" > $RESULTFILE
in 1.4.2-1:
if [[ -w "$RESULTFILE" ]]; then
echo "$RET $*" > $RESULTFILE
else
log "ERROR: $NAME: Unable to write to \"$RESULTFILE\" -- is ${RESULTFILE%/*} read-only?"
syslog "ERROR: $NAME: Unable to write to \"$RESULTFILE\" -- is ${RESULTFILE%/*} read-only?"
syslog_flush
fi
The problem is the if [[ -w "$RESULTFILE" ]]; then
On my systems RESULTFILE doesn't exist by default. So this check fails every single time. If I modify
if [[ -w "$RESULTFILE" ]]; then
echo "$RET $*" > $RESULTFILE
else
log "ERROR: $NAME: Unable to write to \"$RESULTFILE\" -- is ${RESULTFILE%/*} read-only?"
syslog "ERROR: $NAME: Unable to write to \"$RESULTFILE\" -- is ${RESULTFILE%/*} read-only?"
syslog_flush
fi
to
if [[ -w "/var/run/nhc" ]]; then
echo "$RET $*" > $RESULTFILE
else
log "ERROR: $NAME: Unable to write to \"$RESULTFILE\" -- is ${RESULTFILE%/*} read-only?"
syslog "ERROR: $NAME: Unable to write to \"$RESULTFILE\" -- is ${RESULTFILE%/*} read-only?"
syslog_flush
fi
Everything works as expected. I get the .status file and my NHC checks stop timing out.
Let me know if you have any questions.
Thanks,
-Jay