<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Linux Forum &mdash; Демон запуска vdr]]></title>
		<link>https://linuxforum.ru/viewtopic.php?id=30169</link>
		<atom:link href="https://linuxforum.ru/extern.php?action=feed&amp;tid=30169&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «Демон запуска vdr».]]></description>
		<lastBuildDate>Sat, 07 Sep 2013 16:32:09 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Демон запуска vdr]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=362294#p362294</link>
			<description><![CDATA[<p>Всем привет есть демон </p><div class="codebox"><pre><code>#! /bin/bash -p
#
# vdr start-stop script
#
### BEGIN INIT INFO
# Provides:          vdr
# Required-Start:    $remote_fs $network $syslog
# Required-Stop:     $remote_fs $network $syslog
# 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=&quot;Linux Video Disk Recorder&quot;

DAEMON=/usr/sbin/runvdr
PIDFILE=/var/run/runvdr.pid
VDRPRG=/usr/bin/vdr

test -x $DAEMON || exit 0
test -x $VDRPRG || exit 0

. /usr/lib/vdr/config-loader.sh

# Set shutdown command
test &quot;$ENABLE_SHUTDOWN&quot; = &quot;1&quot; &amp;&amp; VDRSHUTDOWN=&quot;/usr/lib/vdr/vdr-shutdown.wrapper&quot; \
                              || VDRSHUTDOWN=&quot;/usr/lib/vdr/vdr-shutdown-message&quot;

. /usr/lib/vdr/plugin-loader.sh
. /usr/lib/vdr/commands-loader.sh


clean_console()
{
    if [ &quot;$KEYB_TTY&quot; != &quot;&quot; ]; then
        tput -Tlinux clear &gt; $KEYB_TTY
    fi
}

configure_console_input()
{
    if [ &quot;$KEYB_TTY&quot; != &quot;&quot; ]; then
        clean_console
        echo -e &quot;This tty is currently mapped to VDR, keypresses aren&#039;t echoed.\r&quot; &gt; $KEYB_TTY
        echo -n &quot;For a login prompt switch to another console.&quot; &gt; $KEYB_TTY
        REDIRECT=&quot;&lt; $KEYB_TTY&quot;
        if [ &quot;$KEYB_TTY_SWITCH&quot; = &quot;1&quot; ]; then
            chvt `echo &quot;$KEYB_TTY&quot; | sed &quot;s/\/dev\/tty//&quot;`
        fi
    fi
}

get_status()
{
    if start-stop-daemon --start --startas $DAEMON --test \
        --name $(basename $DAEMON) --pidfile $PIDFILE &gt;/dev/null
    then
        echo &quot; - is not running.&quot;
        exit 3
    else
        echo &quot; - is running.&quot;
        exit 0
    fi
}

startvdr()
{
    if [ &quot;$ENABLED&quot; != &quot;0&quot; ] ; then
        # only start vdr if there is no other instance running
        if start-stop-daemon --start --startas $DAEMON --test \
            --name $(basename $DAEMON) --pidfile $PIDFILE &gt;/dev/null
        then
            getplugins
            mergecommands &quot;commands&quot;
            mergecommands &quot;reccmds&quot;
            configure_console_input

            if [ &quot;$VFAT&quot; == &quot;1&quot; ]; then
                OPTIONS=&quot;--vfat $OPTIONS&quot;
            fi

            if [ -n &quot;$LIRC&quot; ]; then
                LIRC_OPT=&quot;--lirc=$LIRC&quot;
            else
                LIRC_OPT=&quot;--lirc&quot;
            fi

            start-stop-daemon --start --quiet --startas $DAEMON --background \
                --name $(basename $DAEMON) --pidfile $PIDFILE --make-pidfile -- \
                -v $VIDEO_DIR -c $CFG_DIR -L $PLUGIN_DIR -r $REC_CMD \
                -s $VDRSHUTDOWN -E $EPG_FILE -u $USER -g /tmp \
                --port $SVDRP_PORT $LIRC_OPT $PLUGINS $OPTIONS $REDIRECT
        else
            echo -n &quot; - seems to be running already&quot;
        fi
    else
        echo -n &quot; - aborted (to enable the daemon, edit /etc/default/vdr)&quot;
    fi
}

stopvdr()
{
    if start-stop-daemon --stop --retry 30 \
        --name $(basename $DAEMON) --pidfile $PIDFILE &gt;/dev/null
    then
        start-stop-daemon --stop --retry 30 --oknodo --exec $VDRPRG &gt;/dev/null
        rm -f $PIDFILE
        clean_console
    else
        echo -n &quot; - seems not to be running&quot;
    fi
}

case &quot;$1&quot; in
    start)
        echo -n &quot;Starting $DESC: $NAME&quot;
        startvdr
        echo &quot;.&quot;
        ;;
    stop)
        echo -n &quot;Stopping $DESC: $NAME&quot;
        stopvdr
        echo &quot;.&quot;
        ;;
    restart|force-reload)
        echo -n &quot;Restarting $DESC: $NAME&quot;
        stopvdr
        sleep 4
        startvdr
        echo &quot;.&quot;
        ;;
    status)
        echo -n &quot;Getting status of $DESC: $NAME&quot;
        get_status
        ;;
    *)
        N=/etc/init.d/$NAME
        echo &quot;Usage: $N {start|stop|restart|force-reload}&quot; &gt;&amp;2
        exit 1
        ;;
esac

exit 0</code></pre></div><p>меня интересует как здесь реализована проверка на запуск приложения?</p>]]></description>
			<author><![CDATA[null@example.com (Vladimir17m)]]></author>
			<pubDate>Sat, 07 Sep 2013 16:32:09 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=362294#p362294</guid>
		</item>
	</channel>
</rss>
