Browse Source

added nma exclude filter

master
Robin Thoni 8 years ago
parent
commit
89311111ae
3 changed files with 28 additions and 3 deletions
  1. 19
    2
      bash/bash_preexec_hooks
  2. 1
    1
      bash/install
  3. 8
    0
      bash/nma_exclude

+ 19
- 2
bash/bash_preexec_hooks View File

@@ -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
 }

+ 1
- 1
bash/install View File

@@ -1,6 +1,6 @@
1 1
 #! /usr/bin/env bash
2 2
 
3
-for file in bash_aliases bash_preexec bash_preexec_hooks bashrc git-prompt.sh
3
+for file in bash_aliases bash_preexec bash_preexec_hooks bashrc git-prompt.sh nma_exclude
4 4
 do
5 5
   ln -sf "$PWD"/$file ~/.$file
6 6
 done

+ 8
- 0
bash/nma_exclude View File

@@ -0,0 +1,8 @@
1
+^ssh
2
+^vim
3
+^svim
4
+^sudo vim
5
+^man
6
+^watch
7
+^sudo watch
8
+^eog

Loading…
Cancel
Save