summaryrefslogtreecommitdiffstats
path: root/scripts/watchdog.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/watchdog.sh')
-rwxr-xr-xscripts/watchdog.sh30
1 files changed, 22 insertions, 8 deletions
diff --git a/scripts/watchdog.sh b/scripts/watchdog.sh
index e0fbc7b..df8a07b 100755
--- a/scripts/watchdog.sh
+++ b/scripts/watchdog.sh
@@ -1,5 +1,19 @@
#!/bin/sh
#
+# Copyright (C) 2011 Michael van Rosmalen <mvanrosmalen@zya.nl>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
PATH=/usr/bin:/bin:/usr/sbin:/sbin
@@ -18,19 +32,19 @@ while [ true ]; do
timer=`expr $timer + 5`
# check the state of the video
- state=`upnp-cmd GetTransportInfo | awk '/CurrentTransportState/ {print $3}'`
+ state=`$AV -s localhost -p $UPNPPORT get 2>&1| awk '/^TInfo:/ {print $2}'`
if [ "$state" != $laststate ]; then
- echo "`date +%T` watchdog timer reset after state change to $state"
- timer=0 # reset timer
+ echo "`date +%T` watchdog timer reset after state change to $state"
+ timer=0 # reset timer
fi
if [ $timer -gt $watchdogtimer ]; then
- echo "`date +%T` watchdog timer exceeded, trying to resolve"
- upnp-cmd stop
- sleep 5
- upnp-cmd stop
- timer=`expr $watchdogtimer - 60`
+ echo "`date +%T` watchdog timer exceeded, trying to resolve"
+ $AV -s localhost -p $UPNPPORT stop
+ sleep 5
+ $AV -s localhost -p $UPNPPORT stop
+ timer=`expr $watchdogtimer - 60`
fi
laststate="$state"