Clipinc.sh
Aus VDR Wiki
(Unterschied zwischen Versionen)
(M) |
(M) |
||
Zeile 19: | Zeile 19: | ||
case "$1" in | case "$1" in | ||
-start) | -start) | ||
− | + | if [ -s "${PIDFILE:=$2/clipinc.pid}" ] ; then | |
− | if [ - | + | read PID < "$PIDFILE" |
− | echo $"Clipinc process already active (pid: $PID)" ... | + | echo $"Clipinc process already active" "(pid: $PID)" ... |
else | else | ||
if pidof atd >/dev/null ; then | if pidof atd >/dev/null ; then | ||
if [ -e "$2/recinfo.conf" ] ; then | if [ -e "$2/recinfo.conf" ] ; then | ||
( | ( | ||
− | echo "svdrpsend.pl -p ${VDR_PORT:-2001} MESG "$"Clipinc process started"" ... >/dev/null" | + | echo "clipinc.pl \"$2\" > $CLIPINC_LOGFILE 2>&1 &" |
− | echo " | + | echo "PID=\$!" |
− | echo "svdrpsend.pl -p ${VDR_PORT:-2001} MESG "$"Clipinc process finished"" ... >/dev/null" | + | echo "svdrpsend.pl -p ${VDR_PORT:-2001} MESG \""$"Clipinc process started"" (pid: \$PID) ...\" >/dev/null" |
+ | echo "echo \$PID > \"$PIDFILE\"" | ||
+ | echo "wait \$PID" | ||
+ | echo "rm -f \"$PIDFILE\"" | ||
+ | echo "svdrpsend.pl -p ${VDR_PORT:-2001} MESG \""$"Clipinc process finished"" (pid: \$PID) ...\" >/dev/null" | ||
) | at now | ) | at now | ||
else | else | ||
Zeile 39: | Zeile 43: | ||
;; | ;; | ||
-kill) | -kill) | ||
− | + | if [ -s "${PIDFILE:=$2/clipinc.pid}" ] ; then | |
+ | read PID < "$PIDFILE" | ||
+ | if ps -p $PID >/dev/null 2>&1 ; then | ||
+ | kill -9 $PID | ||
+ | fi | ||
+ | rm -f "$PIDFILE" | ||
+ | fi | ||
;; | ;; | ||
esac | esac |
Version vom 7. Januar 2006, 14:17 Uhr
Script für clipinc
#!/bin/sh # # clipinc.sh # # add this lines to your reccmds.conf: # folgende zeilen in die reccmds.conf eintragen: # # Run clipinc : /path_to_this_script/clipinc.sh -start # Stop clipinc? : /path_to_this_script/clipinc.sh -kill # CONFIG START CLIPINC_LOGFILE="/var/log/vdr/clipinc.log" # CONFIG END case "$1" in -start) if [ -s "${PIDFILE:=$2/clipinc.pid}" ] ; then read PID < "$PIDFILE" echo $"Clipinc process already active" "(pid: $PID)" ... else if pidof atd >/dev/null ; then if [ -e "$2/recinfo.conf" ] ; then ( echo "clipinc.pl \"$2\" > $CLIPINC_LOGFILE 2>&1 &" echo "PID=\$!" echo "svdrpsend.pl -p ${VDR_PORT:-2001} MESG \""$"Clipinc process started"" (pid: \$PID) ...\" >/dev/null" echo "echo \$PID > \"$PIDFILE\"" echo "wait \$PID" echo "rm -f \"$PIDFILE\"" echo "svdrpsend.pl -p ${VDR_PORT:-2001} MESG \""$"Clipinc process finished"" (pid: \$PID) ...\" >/dev/null" ) | at now else echo $"recinfo.conf not found" ... fi else echo $"Jobmanager (atd) is not running" ... fi fi ;; -kill) if [ -s "${PIDFILE:=$2/clipinc.pid}" ] ; then read PID < "$PIDFILE" if ps -p $PID >/dev/null 2>&1 ; then kill -9 $PID fi rm -f "$PIDFILE" fi ;; esac