diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/unix/timer.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/unix/timer.sh b/bin/unix/timer.sh index 3abe701..152d828 100755 --- a/bin/unix/timer.sh +++ b/bin/unix/timer.sh | |||
@@ -1,6 +1,9 @@ | |||
1 | #! /bin/bash | 1 | #! /bin/bash |
2 | # Ref: https://superuser.com/questions/611538/611582#611582 | 2 | # Ref: https://superuser.com/questions/611538/611582#611582 |
3 | 3 | ||
4 | exec 3>&1 | ||
5 | exec 1>/dev/tty | ||
6 | |||
4 | SIGNAL=${1:-SIGTERM} | 7 | SIGNAL=${1:-SIGTERM} |
5 | COMMAND="$2" | 8 | COMMAND="$2" |
6 | 9 | ||
@@ -75,6 +78,8 @@ timer() { | |||
75 | done | 78 | done |
76 | } | 79 | } |
77 | 80 | ||
81 | trap 'exec 1>&3; echo $count; send-notify foo' EXIT KILL TERM STOP | ||
82 | |||
78 | while [ $count -lt $SET ]; do | 83 | while [ $count -lt $SET ]; do |
79 | [ $stop = true ] && sleep 0.3 && continue | 84 | [ $stop = true ] && sleep 0.3 && continue |
80 | timer | 85 | timer |