Showing 1 changed files with 7 additions and 1 deletions
+7 -1
monitoring
... ...
@@ -3,7 +3,8 @@
3 3
 basename=$(basename $0)
4 4
 supervision_status="/dev/shm/${basename}${USER:+.$USER}.status"
5 5
 supervision_disabled="/dev/shm/${basename}${USER:+.$USER}.disabled"
6
-touch $supervision_status $supervision_disabled
6
+supervision_turns="/dev/shm/${basename}${USER:+.$USER}.turns"
7
+touch $supervision_status $supervision_disabled $supervision_turns
7 8
 now=$(date +%s)
8 9
 
9 10
 function _err () {
... ...
@@ -52,6 +53,11 @@ function _load () {
52 53
     fi
53 54
 }
54 55
 
56
+function _turn () {
57
+    test -n "$1" && [[ $1 =~ [0-9]+ ]] || return 1
58
+    echo ${FUNCNAME[1]} >> $supervision_turns
59
+    test $(( $(grep -c ${FUNCNAME[1]} $supervision_turns) % $1 )) -eq 0 && sed -i "/${FUNCNAME[1]}/d" $supervision_turns
60
+}
55 61
 
56 62
 function _do_tests () {
57 63
     local t=