Cutinplace.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
(at != screen)
Zeile 20: Zeile 20:
 
echo $"Cutinplace process already active" "(pid: $PID)" ...
 
echo $"Cutinplace process already active" "(pid: $PID)" ...
 
     else
 
     else
if pidof atd >/dev/null ; then
+
    if [ -s "${PIDFILE:=$1/cip.pid}" ] ; then
    (
+
read PID < "$PIDFILE"
echo "cutinplace \"$1\" >/dev/null &"
+
echo $"Cutinplace process already active" "(pid: $PID)" ...
echo "PID=\$!"
+
    else
echo "svdrpsend.pl -p ${VDR_PORT:-2001} MESG \""$"Cutinplace process started"" (pid: \$PID) ...\" >/dev/null"
+
screen -dmS $$ sh -c \
echo "echo \$PID > \"$PIDFILE\""
+
" \
echo "wait \$PID"
+
    cutinplace \"$1\" &
echo "rm -f \"$PIDFILE\""
+
    $SVDRPSENDCMD MESG \""$"Cutinplace process started"" (pid: \$!) ...\" ; \
echo "svdrpsend.pl -p ${VDR_PORT:-2001} MESG \""$"Cutinplace process finished"" (pid: \$PID) ...\" >/dev/null"
+
    echo \$! > \"$PIDFILE\" ; \
    ) | at now
+
    wait \$! ; \
else
+
    rm -f \"$PIDFILE\" ; \
    echo $"Jobmanager (atd) is not running" ...
+
    $SVDRPSENDCMD MESG \""$"Cutinplace process finished"" (pid: \$!) ...\" \
fi
+
"
 +
    fi
 
     fi
 
     fi
 
fi
 
fi

Version vom 22. April 2006, 09:30 Uhr

Skript für cutinplace.

Datei
$PATH/cutinplace.sh
#!/bin/sh
#
# cutinplace.sh
#
# add this line to your reccmds.conf:
# folgende zeile in die reccmds.conf eintragen:
#
# cutinplace : /path_to_this_script/cutinplace.sh

MARKS=$(wc -l < "$1/marks.vdr" 2>/dev/null)
if [ ${MARKS:-0} -lt 2 ] ; then
    echo $"No editing marks defined" ...
else
    if [ -s "${PIDFILE:=$1/cip.pid}" ] ; then
	read PID < "$PIDFILE"
	echo $"Cutinplace process already active" "(pid: $PID)" ...
    else
    if [ -s "${PIDFILE:=$1/cip.pid}" ] ; then
	read PID < "$PIDFILE"
	echo $"Cutinplace process already active" "(pid: $PID)" ...
    else
	screen -dmS $$ sh -c \
	" \
	    cutinplace \"$1\" &
	    $SVDRPSENDCMD MESG \""$"Cutinplace process started"" (pid: \$!) ...\" ; \
	    echo \$! > \"$PIDFILE\" ; \
	    wait \$! ; \
	    rm -f \"$PIDFILE\" ; \
	    $SVDRPSENDCMD MESG \""$"Cutinplace process finished"" (pid: \$!) ...\" \
	"
    fi
    fi
fi