#!/bin/bash # # Do Nextview EPG update on VDR shutdown # max. time to wait until Nextview completes in minutes; if it doesn't # complete in the given timeframe, we'll shutdown anyways WAIT_FOR_NEXTVIEW=90 SVDRPCMD=/usr/bin/vdr13-svdrpsend.pl sleep 5 # to give VDR time to stabilize after shutdown $SVDRPCMD PLUG pvrinput NXTV # we are counting in half minutes here... WAIT_FOR_NEXTVIEW=$((WAIT_FOR_NEXTVIEW*2)) waited=0; possibly_finished=0; while [ $waited -lt $WAIT_FOR_NEXTVIEW -a $possibly_finished -lt 3 ]; do waited=$((waited+1)); sleep 30; $SVDRPCMD MESG "waiting... $waited" if ! pidof nxtvepg > /dev/null; then if ! pidof -x xmltv2vdr.pl > /dev/null; then $SVDRPCMD MESG "Nextview update probably finished. Shutdown in 2 minutes..." & possibly_finished=$((possibly_finished+1)); fi fi done $SVDRPCMD MESG "Nextview update finished. Shutting down." & shutdown_script=${0%.epg} $shutdown_script $@