Showing 1 changed files with 12 additions and 12 deletions
+12 -12
monitoring
... ...
@@ -1,10 +1,10 @@
1 1
 #!/bin/bash
2 2
 
3 3
 basename=$(basename $0)
4
-supervision_status="/dev/shm/${basename}${USER:+.$USER}.status"
5
-supervision_disabled="/dev/shm/${basename}${USER:+.$USER}.disabled"
6
-supervision_turns="/dev/shm/${basename}${USER:+.$USER}.turns"
7
-touch $supervision_status $supervision_disabled $supervision_turns
4
+monitoring_status="/dev/shm/${basename}${USER:+.$USER}.status"
5
+monitoring_disabled="/dev/shm/${basename}${USER:+.$USER}.disabled"
6
+monitoring_turns="/dev/shm/${basename}${USER:+.$USER}.turns"
7
+touch $monitoring_status $monitoring_disabled $monitoring_turns
8 8
 now=$(date +%s)
9 9
 
10 10
 function _err () {
... ...
@@ -27,7 +27,7 @@ function _load () {
27 27
     )
28 28
     for conf in $*; do
29 29
         count_loaded=0
30
-        if grep -q "^@$conf$" $supervision_disabled; then
30
+        if grep -q "^@$conf$" $monitoring_disabled; then
31 31
             disabled[${#disabled[@]}]=$conf
32 32
         else
33 33
             for dir in ${directories[@]}; do
... ...
@@ -55,15 +55,15 @@ function _load () {
55 55
 
56 56
 function _turn () {
57 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
58
+    echo ${FUNCNAME[1]} >> $monitoring_turns
59
+    test $(( $(grep -c ${FUNCNAME[1]} $monitoring_turns) % $1 )) -eq 0 && sed -i "/${FUNCNAME[1]}/d" $monitoring_turns
60 60
 }
61 61
 
62 62
 function _do_tests () {
63 63
     local t=
64 64
     for t in $(declare -f | sed -rn '/^[[:alpha:]]/s/^([[:alnum:]_]+)\s*\(\)\s*$/\1/p'); do
65 65
         local msg=
66
-        if grep -q "^${t}$" $supervision_disabled; then
66
+        if grep -q "^${t}$" $monitoring_disabled; then
67 67
             echo supervision by $t disabled
68 68
         else
69 69
             msg=$( $t | sed 's/$/%0a/g' )
... ...
@@ -73,7 +73,7 @@ function _do_tests () {
73 73
                 err[${#err[@]}]="${msg}"
74 74
             else
75 75
                 if test -n "${!t}"; then
76
-                    sed -ri "/^$t=.+$/d" $supervision_status
76
+                    sed -ri "/^$t=.+$/d" $monitoring_status
77 77
                 fi
78 78
             fi
79 79
         fi
... ...
@@ -81,7 +81,7 @@ function _do_tests () {
81 81
 }
82 82
 
83 83
 function _do_manage_errors () {
84
-    source $supervision_status
84
+    source $monitoring_status
85 85
     local msg=
86 86
     local t=
87 87
     local errors=
... ...
@@ -95,11 +95,11 @@ function _do_manage_errors () {
95 95
             errors="${errors}"'*'" [${t}] ${msg}"
96 96
             if test -n "${!t}"; then
97 97
                 if test ${!t} -lt $(( $now - 86400 )); then
98
-                    sed -ri "s/^(${t}=).+$/\1$now/" $supervision_status
98
+                    sed -ri "s/^(${t}=).+$/\1$now/" $monitoring_status
99 99
                     let notification++
100 100
                 fi
101 101
             else
102
-                echo "${t}=$now" >> $supervision_status
102
+                echo "${t}=$now" >> $monitoring_status
103 103
                 let notification++
104 104
             fi
105 105
         done