后端关闭系统启动

时间:2014-07-16 07:12:57

标签: python linux embedded-linux lighttpd init

我在lighttpd(fastcgi)上使用python。当我使用/etc/init.d/lighttpd start启动服务器时,一切正常。

但是现在我已经将它添加到带有update-rc.d lighttpd defaults 60的system-v init中,并且在重新启动后我在错误日志中有这个东西:

2011-03-24 22:57:01: (log.c.164) server started
2011-03-24 22:57:42: (mod_fastcgi.c.1754) connect failed: Connection refused on unix:/tmp/dvr.sock-0
2011-03-24 22:57:42: (mod_fastcgi.c.3021) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 1
2011-03-24 22:57:55: (mod_fastcgi.c.2562) unexpected end-of-file (perhaps the fastcgi process died): pid: 1509 socket: unix:/tmp/dvr.sock-0
2011-03-24 22:57:55: (mod_fastcgi.c.3299) child exited, pid: 1509 status: 1
2011-03-24 22:57:55: (mod_fastcgi.c.3346) response not received, request sent: 858 on socket: unix:/tmp/dvr.sock-0 for /dvr.fcgi?, closing connection

/etc/init.d/lighttpd restart之后它开始正常工作。

1 个答案:

答案 0 :(得分:1)

我忘了说我使用环境变量为我的烧瓶项目选择设置文件。当然,这个变量是在/etc/profile中设置的,这就是为什么我能够从shell正确启动项目的原因。

所以在我的情况下,我必须使用bin-environment选项将此变量传递给lighttpd,以使其可用于fcgi脚本:

fastcgi.server = (
    "/dvr.fcgi" => (
        "main" => (
            "socket" => "/tmp/dvr.sock",
            "bin-path" => "/var/www/dvr/conf/lighttpd/dvr.fcgi",
            "bin-environment" => (
                    "DVR_SETTINGS" => "/var/www/dvr/settings/production.py"
            ),
            "check-local" => "disable",
            "max-procs" => 1,
        )
    ),
)