Skip to content
Snippets Groups Projects
Commit 4dfce302 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

add filecheck if they are writable

parent 1df2a0ce
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@
_product="ICINGA PASSIVE CLIENT"
_version="0.5"
_version="0.6"
_license="GNU GPL 3.0"
_copyright='(c) 2020 Institute for Medical Education * University of Bern'
......@@ -113,7 +113,18 @@ function loopChecks(){
_log "---------- starting in a permanent loop"
echo "Serviceloop started `date` - process id $$" > "${lockfile}"
_getFileSnapshot>$snapShotStart
if [ $? -ne 0 ]; then
_log "ABORT: Lock file is not writable ${lockfile}."
ls -l "${lockfile}"
exit 1
fi
_getFileSnapshot>${snapShotStart}
if [ $? -ne 0 ]; then
_log "ABORT: Snapshot file is not writable ${snapShotStart}."
ls -l "${snapShotStart}"
exit 1
fi
while true; do
# typeset -i local iSleep=$(($RANDOM%$sleeptime))
# sleep minimum is half of $sleeptime
......@@ -123,6 +134,11 @@ function loopChecks(){
_log "______________________________________________________________________"
_log ""
_getFileSnapshot>$snapShotCurrent
if [ $? -ne 0 ]; then
_log "ABORT: Snapshot file is not writable ${snapShotCurrent}."
ls -l "${snapShotCurrent}"
exit 1
fi
diff $snapShotStart $snapShotCurrent >/dev/null
if [ $? -ne 0 ]; then
_log "ABORT: Files were updated / overwritten. The loop must be restarted.\n`diff $snapShotStart $snapShotCurrent`"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment