Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 4218b2f158
Fetching contributors…

Cannot retrieve contributors at this time

executable file 47 lines (38 sloc) 1.21 kB
#!/bin/sh
#
# VDR Shutdown Script - Tobias Grimm <tg@e-tobi.net>
# -------------------
#
# see README.Debian
#
. /usr/lib/vdr/config-loader.sh
SHUTDOWN_HOOKS_DIR=/usr/share/vdr/shutdown-hooks/
log="logger -t vdr-shutdown"
shutdownhooks=`find $SHUTDOWN_HOOKS_DIR -maxdepth 1 -xtype f | sort`
for shutdownhook in $shutdownhooks; do
TRY_AGAIN=0
if [ -x $shutdownhook ]; then
$log "executing $shutdownhook"
result_data=`$shutdownhook "$@"`
else
$log "executing $shutdownhook as shell script"
result_data=`/bin/sh $shutdownhook "$@"`
fi
result=$?
eval $result_data
if [ $result -ne 0 ] ; then
$log "Shutdown aborted by $shutdownhook with exitcode $result"
echo "Shutdown abgebrochen / Shutdown aborted!" &
[ -z "$ABORT_MESSAGE" ] || echo "$ABORT_MESSAGE" &
exit $result
fi
if [ $TRY_AGAIN -gt 0 ]
then
$log "$shutdownhook requests to try again in $TRY_AGAIN minutes"
nohup sh -c "( sleep $(( $TRY_AGAIN * 60 )) && $svdrpsend \"HITK Power\" )" >/dev/null 2>&1 &
echo "Shutdown aborted. Retry in $TRY_AGAIN minutes." &
exit 0
fi
done
eval $SHUTDOWNCMD &
echo "OK"
Jump to Line
Something went wrong with that request. Please try again.