#!/sbin/runscript # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License, v2 or later # Path to ud_suite.cfg CONFIGFILE=/etc/udrec_suite/ud_suite.conf depend() { after net } start() { ebegin "Starting udrec" if [ -f "$CONFIGFILE" ]; then source "$CONFIGFILE" fi echo su - $UDREC_USER -c "$UD_DAEMON $UD_DAEMON_OPTS &" start-stop-daemon --start \ --chuid $UDREC_USER \ --background \ --make-pidfile \ --pidfile /var/run/udrec.pid \ --exec $UD_DAEMON -- $UD_DAEMON_OPTS exitcode=$? if [ $exitcode == 0 ]; then # start Xvfb XLOCK=`basename \`ls /tmp/.X?-lock | sort | tail -n 1 \`` DISP=`echo $XLOCK | sed -e 's/^\.X\([0-9]\)-lock/\1/g'` [ -z "$DISP" ] && DISP=0 NEXT_DISP=`echo "$DISP+1" | bc` echo -n "Starting Xvfb on display $NEXT_DISP: " # # start Xvfb as root ! # #su - $UDREC_USER -c "$XVFB :$NEXT_DISP >/dev/null 2>&1 &" start-stop-daemon --start \ --chuid $UDREC_USER \ --background \ --make-pidfile \ --pidfile /var/run/udrec_xvfb.pid \ --exec $XVFB -- :$NEXT_DISP exitcode=$? fi if [ $exitcode == 0 ] && [ x${USE_VLC} == x"1" ]; then # start vlc echo -n "Starting vlc: " #su - $UDREC_USER -c "$UD_STARTVLC >/dev/null 2>&1 &" echo su - $UDREC_USER -c "$UD_STARTVLC >/dev/null 2>&1 &" start-stop-daemon --start \ --chuid $UDREC_USER \ --exec $UD_STARTVLC fi eend $? } stop() { ebegin "Stopping udrec" start-stop-daemon --stop --quiet --pidfile /var/run/udrec.pid start-stop-daemon --stop --quiet --pidfile /var/run/udrec_xvfb.pid start-stop-daemon --stop --quiet --name udrecemu start-stop-daemon --stop --quiet --name nfrec start-stop-daemon --stop --quiet --name $UD_STARTVLC start-stop-daemon --stop --quiet --name vlc eend $? }