Raspbian VDR System-V-Init script
Aus VDR Wiki
(Unterschied zwischen Versionen)
Hulk (Diskussion | Beiträge) |
Hulk (Diskussion | Beiträge) |
||
Zeile 203: | Zeile 203: | ||
[[Kategorie:RaspberryPi]] | [[Kategorie:RaspberryPi]] | ||
+ | [[Kategorie:Raspbian VDR Streaming Client mittels Streamdev und rpihddevice]] |
Aktuelle Version vom 15. November 2015, 13:42 Uhr
[Bearbeiten] VDR mit System-V-Init starten
Achtung: Dies ist experimentell!
Der System-V-Init-Script verwendet nicht die runvdr. Er ist bewusst einfacher gehalten als bei e-toby oder Ubuntu. Es gibt 2 Dateien:
- /etc/default/vdr
- /etc/init.d/vdr
Auserdem Softlinks in den Ordnern rcX.d.
/etc/default/vdr
# /etc/default/vdr # # Change to 1 to enable vdr's init-script ENABLED=1 . /etc/environment #setterm -clear -cursor off > /dev/tty9; chvt 9; #VDRKONSOLE="< /dev/tty9" OPTIONS="-w 60 -c /var/lib/vdr --log=3" # For other options see manpage vdr.1 VDRSHUTDOWN=/usr/local/bin/vdrpoweroff.sh USER=pi SVDRP_PORT=6419 PLUGINS="-P rpihddevice -P streamdev-client -P epgsync -P remotetimers -Psvdrpservice 192.168.168.20:6419" DAEMON="/usr/local/bin/vdr" # Video-Directory VIDEO_DIR="/srv/vdr/video" export LANG=de_DE.utf8 export LC_COLLATE=de_DE.utf8 export VDR_CHARSET_OVERRIDE=ISO-8859-9
/etc/init.d/vdr
#! /bin/bash -p # # vdr start-stop script # ### BEGIN INIT INFO # Provides: vdr # Required-Start: $all # Required-Stop: $remote_fs $network $syslog lirc # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Starts the Linux Video Disk Recorder (VDR) # Description: Starts the Linux Video Disk Recorder (VDR), # if it is enabled in /etc/default/vdr. ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin NAME=vdr DESC="Linux Video Disk Recorder" #DAEMON=/usr/sbin/runvdr PIDFILE=/var/run/runvdr.pid test -x $DAEMON || exit 0 . /etc/default/vdr VDROPTIONS="-v $VIDEO_DIR -s $VDRSHUTDOWN -u $USER -g /tmp --port $SVDRP_PORT $OPTIONS $PLUGINS $VDRKONSOLE" clean_console() { if [ "$KEYB_TTY" != "" ]; then tput -Tlinux clear > $KEYB_TTY fi } configure_console_input() { if [ "$KEYB_TTY" != "" ]; then clean_console echo -e "This tty is currently mapped to VDR, keypresses aren't echoed.\r" > $KEYB_TTY echo -n "For a login prompt switch to another console." > $KEYB_TTY REDIRECT="< $KEYB_TTY" if [ "$KEYB_TTY_SWITCH" = "1" ]; then chvt `echo "$KEYB_TTY" | sed "s/\/dev\/tty//"` fi fi } get_status() { if start-stop-daemon --start --startas $DAEMON --test \ --name $(basename $DAEMON) --pidfile $PIDFILE >/dev/null then echo " - is not running." exit 3 else echo " - is running." exit 0 fi } startvdr() { if [ "$ENABLED" != "0" ] ; then # only start vdr if there is no other instance running if start-stop-daemon --start --startas $DAEMON --test \ --name $(basename $DAEMON) --pidfile $PIDFILE >/dev/null then configure_console_input if [ -n "$LIRC" ]; then OPTIONS="--lirc=$LIRC $OPTIONS" fi if [ "$VFAT" == "1" ]; then OPTIONS="--dirname=,,1 $OPTIONS" fi if [ "$CACHE_DIR" != "" ]; then OPTIONS="--cachedir=$CACHE_DIR $OPTIONS" fi if [ "$RES_DIR" != "" ]; then OPTIONS="--resdir=$RES_DIR $OPTIONS" fi start-stop-daemon --start --quiet --startas $DAEMON --background \ --name $(basename $DAEMON) --pidfile $PIDFILE --make-pidfile -- \ $VDROPTIONS else echo -n " - seems to be running already" fi else echo -n " - aborted (to enable the daemon, edit /etc/default/vdr)" fi } stopvdr() { if start-stop-daemon --stop --retry 30 \ --name $(basename $DAEMON) --pidfile $PIDFILE >/dev/null then start-stop-daemon --stop --retry 30 --oknodo --exec $DAEMON >/dev/null rm -f $PIDFILE clean_console else echo -n " - seems not to be running" fi } case "$1" in start) echo -n "Starting $DESC: $NAME" startvdr echo "." ;; stop) echo -n "Stopping $DESC: $NAME" stopvdr echo "." ;; restart|force-reload) echo -n "Restarting $DESC: $NAME" stopvdr sleep 4 startvdr echo "." ;; status) echo -n "Getting status of $DESC: $NAME" get_status ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0
rcX.d-Links erzeugen.
sudo insserv
Vdr manuell starten
sudo service vdr start
Vdr manuell stoppen
sudo service vdr stop
Mehr infos über Init-Scripts: