如何在 upstart start-stop-daemon 中使用 /usr/bin/xvfb-run

如何在 upstart start-stop-daemon 中使用 /usr/bin/xvfb-run

这是正确的语法吗?看来 Upstart 正在启动此守护进程的两个实例:

start on runlevel [2345]
stop on runlevel [06]

limit nofile 32768 32768
env DISPLAY=:0
respawn

script
    [ -r /etc/default/splash ] && . /etc/default/splash
    logdir=${SPLASH_LOGDIR:-/var/log/splash}
    proxyprofilespath=${SPLASH_PROXYPROFILESPATH:-/etc/splash/proxy-profiles}
    jsprofilespath=${SPLASH_JSPROFILESPATH:-/etc/splash/js-profiles}
    maxrss=${SPLASH_MAXRSS:-$(awk '/MemTotal/{print $2*0.75/1024}' /proc/meminfo)}
    cachepath=${SPLASH_CACHEPATH:-/var/cache/splash}
    cachesize=${SPLASH_CACHESIZE:-512}  # 512MB

    chown proxy:proxy $logdir $proxyprofilespath $cachepath $jsprofilespath

# May need to figure out how to run this /usr/bin/xvfb-run --auto-servernum

    exec start-stop-daemon --start \
        --chuid proxy:proxy \
        --pidfile /var/run/splash.pid \
        --exec /usr/bin/xvfb-run /usr/bin/python -- \
            -m splash.server \
            --maxrss $maxrss \
            --logfile $logdir/splash.log \
            --proxy-profiles-path=$proxyprofilespath \
            --js-profiles-path=$jsprofilespath \
            --cache --cache-path=$cachepath --cache-size=$cachesize \
            --manhole \
            >$logdir/splash.out 2>$logdir/splash.err
end script

ps -ef...

proxy      701     1  0 21:45 ?        00:00:00 /bin/sh /usr/bin/xvfb-run /usr/bin/python -m splash.server --maxrss 1239.67 --logfile /var/log/splash/splash.log --proxy-profiles-path=/etc/splash/proxy-profiles --js-profiles-path=/etc/splash/js-profiles --cache --cache-path=/var/cache/splash --cache-size=512 --manhole
proxy      776   701  0 21:45 ?        00:00:05 /usr/bin/python -m splash.server --maxrss 1239.67 --logfile /var/log/splash/splash.log --proxy-profiles-path=/etc/splash/proxy-profiles --js-profiles-path=/etc/splash/js-profiles --cache --cache-path=/var/cache/splash --cache-size=512 --manhole

答案1

这一行:
--exec /usr/bin/xvfb-run /usr/bin/python -- \
应该是:
--exec /usr/bin/xvfb-run -- /usr/bin/python \

为什么?-- 将命令和参数分隔开。/usr/bin/xvfb-run 是命令。/usr/bin/python 是该命令的第一个参数。

相关内容