|
@@ -1,6 +1,6 @@
|
1
|
1
|
#! /usr/bin/env bash
|
2
|
2
|
|
3
|
|
-export __BASH_HOOKS_TIMEOUT__=60
|
|
3
|
+export __BASH_HOOKS_TIMEOUT__=10
|
4
|
4
|
|
5
|
5
|
export __BASH_HOOKS_COMMAND__=
|
6
|
6
|
export __BASH_HOOKS_TIME__=
|
|
@@ -47,9 +47,26 @@ __bash_hooks_command_finished()
|
47
|
47
|
{
|
48
|
48
|
if [ "$2" -ge "$__BASH_HOOKS_TIMEOUT__" ]
|
49
|
49
|
then
|
|
50
|
+ send_notif=1
|
|
51
|
+ while read exp
|
|
52
|
+ do
|
|
53
|
+ if [ $(echo "${1}" | grep -c "${exp}") -ge 1 ]
|
|
54
|
+ then
|
|
55
|
+ send_notif=0
|
|
56
|
+ fi
|
|
57
|
+ done < ~/.nma_exclude
|
|
58
|
+
|
50
|
59
|
human=$(displaytime "$2")
|
51
|
60
|
text="Command \"$1\" finished in $human ($2 seconds)"
|
|
61
|
+ if [ ${send_notif} -eq 1 ]
|
|
62
|
+ then
|
|
63
|
+ text="${text} (notified)"
|
|
64
|
+ fi
|
52
|
65
|
echo "$text"
|
53
|
|
- (nma $(hostname -f) "$1" "$text" >/dev/null 2>/dev/null &)
|
|
66
|
+
|
|
67
|
+ if [ ${send_notif} -eq 1 ]
|
|
68
|
+ then
|
|
69
|
+ (nma $(hostname -f) "$1" "$text" >/dev/null 2>/dev/null &)
|
|
70
|
+ fi
|
54
|
71
|
fi
|
55
|
72
|
}
|