Clipinc.sh
Aus VDR Wiki
(Unterschied zwischen Versionen)
(at != screen) |
|||
| Zeile 17: | Zeile 17: | ||
# CONFIG END | # CONFIG END | ||
| − | case | + | case $1 in |
| − | + | -start) | |
if [ -s "${PIDFILE:=$2/clipinc.pid}" ] ; then | if [ -s "${PIDFILE:=$2/clipinc.pid}" ] ; then | ||
read PID < "$PIDFILE" | read PID < "$PIDFILE" | ||
| Zeile 38: | Zeile 38: | ||
fi | fi | ||
;; | ;; | ||
| − | + | -kill) | |
if [ -s "${PIDFILE:=$2/clipinc.pid}" ] ; then | if [ -s "${PIDFILE:=$2/clipinc.pid}" ] ; then | ||
read PID < "$PIDFILE" | read PID < "$PIDFILE" | ||
| Zeile 48: | Zeile 48: | ||
;; | ;; | ||
esac | esac | ||
| + | |||
| + | exit $? | ||
</pre> | </pre> | ||
}} | }} | ||
[[Kategorie:Skripte]] | [[Kategorie:Skripte]] | ||
Version vom 23. April 2006, 12:23 Uhr
Skript für clipinc
$PATH/clipinc.sh
#!/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 [ -e "$2/recinfo.conf" ] ; then
screen -dmS $$ sh -c \
" \
clipinc.pl \"$2\" > \"$CLIPINC_LOGFILE\" 2>&1 &
svdrpsend.pl -p ${VDR_PORT:-2001} MESG \""$"Clipinc process started"" (pid: \$!) ...\" ; \
echo \$! > \"$PIDFILE\" ; \
wait \$! ; \
rm -f \"$PIDFILE\" ; \
svdrpsend.pl -p ${VDR_PORT:-2001} MESG \""$"Clipinc process finished"" (pid: \$!) ...\" ; \
"
else
echo $"recinfo.conf not found" ...
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
exit $?