OS X 上的 Pylons:正确的 launchd plist 来启动并保持 pylons 服务器的活动?

发布于 2024-10-31 15:41:31 字数 2017 浏览 1 评论 0原文

更新:这只是 Pylons 应用程序中的一个导入错误(因为运行 launchd 作业时 $PYTHONPATH 不同),导致了失败重生周期。非常感谢那些让我查看日志的人。

大家好,

我在 OS X 上,尝试设置一个启动作业来启动并保持我的 pylons 应用程序的活动。

我像往常一样加载作业:

sudo launchctl unload /Library/LaunchDaemons/dvlf.plist

我在终端中没有看到任何错误。服务器永远不会出现。相反,我在控制台上看到了这一点:

4/12/11 6:23:57 PM  com.apple.launchd[1]    (com.dvlf.pylons) Throttling respawn: Will start in 9 seconds

这是 .plist 文件。任何想法都将不胜感激!

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Disabled</key>
    <false/>
    <key>KeepAlive</key>
    <true/>
    <key>Label</key>
    <string>com.dvlf.pylons</string>
    <key>EnvironmentVariables</key>
        <dict>
                <key>PYTHON_EGG_CACHE</key>
                <string>/tmp/.python-eggs</string>
        </dict>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/paster</string>
        <string>serve</string>
        <string>--reload</string>
        <string>/Volumes/w/artfl/projects/dodgr/servers/pylons/DODGR/production.ini</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>Umask</key>
    <integer>7</integer>
    <key>UserName</key>
    <string>_www</string>
    <key>WorkingDirectory</key>
    <string>/Volumes/w/artfl/projects/dodgr/servers/pylons/DODGR/</string>
    <key>StandardErrorPath</key>
    <string>/var/log/dvlf_paster_error.log</string>
    <key>StandardOutPath</key>
    <string>/var/log/dvlf_output.log</string>
</dict>
</plist>

Update: It was simply an import error in the Pylons app (because $PYTHONPATH is different when running a launchd job) that was causing a fail-respawn cycle. Many thanks for those who told me to look at my logs.

Hi all,

I'm on OS X, trying to set up a launchd job to start and keep alive my pylons application.

I load the job as usual:

sudo launchctl unload /Library/LaunchDaemons/dvlf.plist

I see no errors in the terminal. The server never comes up. Instead I see this on the console:

4/12/11 6:23:57 PM  com.apple.launchd[1]    (com.dvlf.pylons) Throttling respawn: Will start in 9 seconds

Here's the .plist file. Any ideas are greatly appreciated!

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Disabled</key>
    <false/>
    <key>KeepAlive</key>
    <true/>
    <key>Label</key>
    <string>com.dvlf.pylons</string>
    <key>EnvironmentVariables</key>
        <dict>
                <key>PYTHON_EGG_CACHE</key>
                <string>/tmp/.python-eggs</string>
        </dict>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/paster</string>
        <string>serve</string>
        <string>--reload</string>
        <string>/Volumes/w/artfl/projects/dodgr/servers/pylons/DODGR/production.ini</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>Umask</key>
    <integer>7</integer>
    <key>UserName</key>
    <string>_www</string>
    <key>WorkingDirectory</key>
    <string>/Volumes/w/artfl/projects/dodgr/servers/pylons/DODGR/</string>
    <key>StandardErrorPath</key>
    <string>/var/log/dvlf_paster_error.log</string>
    <key>StandardOutPath</key>
    <string>/var/log/dvlf_output.log</string>
</dict>
</plist>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

揽清风入怀 2024-11-07 15:41:31

当我在 SysV init 系统(/etc/inittab 条目)上看到“重生太快”时,这是因为相关程序使用传统的“双叉,然后执行”策略来成为守护进程。许多此类程序(例如 sshdsylogd)支持命令行开关(例如,-D 代表 sshd),指示它们避免fork()-ing。

问题是 init (大概还有 launchd)正在尝试监视进程,以便在它们退出时处理它们的重生。当程序尝试将自身置于后台(将自身与父进程、进程组和所有相关信号处理断开连接)时,这会被检测为需要重生的近乎立即退出。 inittab(以及大概launchd)正在施加速率限制,以防止某个失败的程序使系统过度繁忙。

此问题的解决方案是查看是否可以配置此 dvlfs.pylons 程序在前台运行或“不分离”或“不守护进程”...达到此效果的术语。

When I've seen "respawning too fast" on SysV init systems (/etc/inittab entries) it's been because the program in question was using the traditional "double fork, then exec" strategy to become a daemon. Many such programs (such as sshd and sylogd) support command line switches (-D for sshd, for example) which instruct them to refrain from fork()-ing.

The problem is that init (and presumably launchd) are attempting to monitor the process in order to handle respawning them if/when they exit. When the program attempts to put itself in the background (disconnect itself from the parent process, process group, and all related signal handling) then this is detected as a near immediate exit which requires the respawn. inittab (and, again, presumably launchd) are imposing rate limiting to keep one failing program from keeping the system excessively busy.

The solution to this issue see if you can configure this dvlfs.pylons program to run in the foreground or "don't detach" or "don't daemonize" ... terminology to that effect.

2024-11-07 15:41:31

出现重生消息通常是因为进程在启动后不久崩溃,可能是因为配置错误。所以,检查你的日志文件。

从 plist 中:
你真的有这些目录/文件吗? (检查 plist 中的所有路径 - 最常见的错误)

/Volumes/w/artfl/projects/dodgr/servers/pylons/DODGR/production.ini
/Volumes/w/artfl/projects/dodgr/servers/pylons/DODGR/

如果没有,您应该重新编辑您的 plist。

The respawn message usually occurs because the process crashed shortly after startup, probably because bad configuration. So, check your logfiles.

From the plist:
do you really have these dirs/files? (check all path in your plist - the most common error)

/Volumes/w/artfl/projects/dodgr/servers/pylons/DODGR/production.ini
/Volumes/w/artfl/projects/dodgr/servers/pylons/DODGR/

if not, you should re-edit your plist.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文