Skip to content
Snippets Groups Projects
Commit 2b8451ae authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Fail if not allowed to manipulate the temporary files. Clean up all

temporary files.
parent 14217f99
No related branches found
No related tags found
No related merge requests found
...@@ -62,7 +62,16 @@ state=$statecache-$partno ...@@ -62,7 +62,16 @@ state=$statecache-$partno
find $BASE/lysrdiff/state -type f \ find $BASE/lysrdiff/state -type f \
-printf "%TY-%Tm-%Td %TH:%TM:%TS %P\n" \ -printf "%TY-%Tm-%Td %TH:%TM:%TS %P\n" \
| sort > $statecache.$partno.$$ | sort > $statecache.$partno.$$
mv -f $statecache.$partno.$$ $state mv -f $statecache.$partno.$$ $state || {
echo UNKNOWN - mv failed
rm $statecache.$partno.$$
exit 3
}
rm -f $state-stale $state-active || {
echo UNKNOWN - rm failed
rm $state
exit 3
}
echo $staletime MARKER \ echo $staletime MARKER \
| sort $state - \ | sort $state - \
...@@ -90,6 +99,8 @@ then ...@@ -90,6 +99,8 @@ then
END { if (sz >= 200) printf ", others" } ' \ END { if (sz >= 200) printf ", others" } ' \
|sed s'/, \([^,]*\)$/ and \1/' |sed s'/, \([^,]*\)$/ and \1/'
echo '. | activity='$ACTIVITY stale=$STALE failed=`grep -c -- '-fail$' $state` echo '. | activity='$ACTIVITY stale=$STALE failed=`grep -c -- '-fail$' $state`
rm $state $state-stale $state-active
exit 2 exit 2
fi fi
...@@ -103,14 +114,17 @@ then ...@@ -103,14 +114,17 @@ then
END { if (sz >= 200) printf ", others" } ' \ END { if (sz >= 200) printf ", others" } ' \
|sed s'/, \([^,]*\)$/ and \1/' |sed s'/, \([^,]*\)$/ and \1/'
echo '. | activity='$ACTIVITY stale=$STALE failed=0 echo '. | activity='$ACTIVITY stale=$STALE failed=0
rm $state $state-stale $state-active
exit 2 exit 2
fi fi
if [ $ACTIVITY = 0 ] if [ $ACTIVITY = 0 ]
then then
echo -n 'WARNING - No activity. | activity='0 stale=$STALE failed=0 echo -n 'WARNING - No activity. | activity='0 stale=$STALE failed=0
rm $state $state-stale $state-active
exit 1 exit 1
fi fi
echo 'OK - all ok. | activity='$ACTIVITY stale=0 failed=0 echo 'OK - all ok. | activity='$ACTIVITY stale=0 failed=0
rm $state $state-stale $state-active
exit 0 exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment