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

Use a trap statement to simplify removal of state files

parent e61d214e
Branches
No related tags found
No related merge requests found
......@@ -87,6 +87,8 @@ echo $acttime MARKER \
| sed -e '0,/MARKER$/d' \
> $state-active
trap "rm $state $state-stale $state-active" 0
FAILED=`grep -c -- '--fail$' $state`
STALE=`wc -l < $state-stale`
ACTIVITY=`wc -l < $state-active`
......@@ -108,7 +110,6 @@ then
END { if (sz >= 200) printf ", others" } ' \
|sed s'/, \([^,]*\)$/ and \1/'
echo ". | $PERF"
rm $state $state-stale $state-active
exit 2
fi
......@@ -126,7 +127,6 @@ then
END { if (sz >= 200) printf ", others" } ' \
|sed s'/, \([^,]*\)$/ and \1/'
echo ". | $PERF"
rm $state $state-stale $state-active
exit 2
fi
......@@ -145,8 +145,6 @@ then
END { if (sz >= 200) printf ", others" } ' \
|sed s'/, \([^,]*\)$/ and \1/'
echo ". | $PERF"
rm $state $state-stale $state-active
exit 1
fi
......@@ -160,17 +158,14 @@ then
END { if (sz >= 200) printf ", others" } ' \
|sed s'/, \([^,]*\)$/ and \1/'
echo ". | $PERF"
rm $state $state-stale $state-active
exit 1
fi
if [ $ACTIVITY = 0 ]
then
echo "WARNING - No activity. | $PERF"
rm $state $state-stale $state-active
exit 1
fi
echo "OK - all ok. | $PERF"
rm $state $state-stale $state-active
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment