[-]
[+]
|
Changed |
_service:tar_git:ngfd-watch.spec
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://github.com/b100dian/ngfd-watch.git</param>
<param name="branch">master</param>
- <param name="revision">0.0.3</param>
+ <param name="revision">0.0.4</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Changed |
_service:tar_git:ngfd-watch-0.0.4.tar.gz/ngfd-watch.sh
^
|
@@ -3,7 +3,7 @@
#
# This script watches the file handles of ngfd by means of lsof.
# Whenever the same handle and filename that contains .ogg appear
-# between two consecutive time INTERVALs, it kills ngfd.
+# for CONSECUTIVE_MATCHES times over an INTERVALs, it kills ngfd.
# It also sens a notification that it did that, so you can see if it happened.
#
# The idea is that an audio file opened for a large amount of time
@@ -12,6 +12,11 @@
INTERVAL=10s
CONSECUTIVE_MATCHES=6
+# You can override the above two vars in /etc/ngfd-watch
+[ -e /etc/ngfd-watch ] && source /etc/ngfd-watch
+
+echo "ngfd-watch every $INTERVAL and restart after $CONSECUTIVE_MATCHES matches."
+
LAST_OGG=
LAST_OGG_FD=
MATCH_COUNT=0
@@ -19,7 +24,7 @@
while :
do
sleep $INTERVAL
- OGG_LINE=$( lsof -p $( pgrep -x ngfd ) | grep \\.ogg | head -n 1 )
+ OGG_LINE=$( lsof -p $( pgrep -x ngfd ) | grep \\.ogg | tail -n 1 )
if [ -z "$OGG_LINE" ];
then
LAST_OGG=
@@ -32,7 +37,7 @@
if [ $OGG = "$LAST_OGG" ] && [ $OGG_FD = "$LAST_OGG_FD" ] && [ $MATCH_COUNT -eq $CONSECUTIVE_MATCHES ];
then
echo COMA COMA COMA COMA COMA CHAMELEON $( date -Iseconds ) $( pidof ngfd ) $OGG_FD $OGG
- kill -9 $( pgrep -x ngfd ) && notificationtool -o add "Restarted ngfd, coma" "I had to restart ngfd on $(date -Iseconds), reason $OGG"
+ kill -9 $( pgrep -x ngfd ) && notificationtool -o add "Restarted ngfd, coma" "I had to restart ngfd on $(date -Iseconds), reason $OGG" -A ngfd-watch
LAST_OGG=
LAST_OGG_FD=
MATCH_COUNT=0
|