Hudson-ci 拒绝在 OSX 上启动 screen
我在从 hudson 在 OSX 上启动 gnu-screen 时遇到一个非常间歇性的问题(现在一直失败)。我有一个 shell 脚本就是这样做的:
#!/bin/bash
screen -dm -S foobar
作为 hudson 用户从命令行运行,效果很好,并且此屏幕会话显示为 screen -ls。从哈德森任务来看,这是行不通的。它曾经可以工作几个小时,但我不知道为什么它不再工作了。
到目前为止我已经尝试过:
- 将 screen 命令放入单独的 bash 脚本中。例如。 /tmp/foo.sh
- 输入路径前缀,以防找不到 screen 命令。但 screen -ls 工作得很好,所以这不是
- 以非分离模式运行 screen,只是作为测试。这如预期失败,并显示“必须连接到终端。”。所以这意味着屏幕至少正在考虑做正确的事情。
- 将 screen 作为 LaunchDaemon 运行,我以 launchctl 启动(将 plist 文件创建为 OnDemand)。同样的问题。
有什么方法可以调试正在发生的事情吗?我想不出如何找出为什么事情不起作用,我完全没有想法。我也没有看到任何可能有帮助的日志。
我的系统是:OSX 10.6.5;画面版4.00.03
更新: 我只是想看看 /var/log/system.log ,我发现:
Feb 24 23:19:00 macmini2 com.apple.launchd[1] (0x1037c0.anonymous.screen[57291]): Switching sessions is not allowed in the system Mach bootstrap.
Feb 24 23:19:00 macmini2 com.apple.launchd[1] (0x1037c0.anonymous.screen[57291]): _vprocmgr_switch_to_session(): kr = 0x44c
我似乎必须进一步研究这一点,但我不想沿着我前几次搜索中建议的路径走下去这个错误,是安装fink版本的screen,或者从源代码构建screen。我宁愿尽可能保持机器原样(尽管我不反对从源代码编译屏幕,如果这是唯一的解决方案)。
I have a very intermittent issue (and now constant failure) launching gnu-screen on OSX from hudson. I have a shell script that does just this:
#!/bin/bash
screen -dm -S foobar
From the command-line as the hudson user this works just fine, and this screen session show up with screen -ls. From the hudson task this does not work. It used to work for a few hours and I have no idea why it does not work any more.
What I've tried so far:
- Put the screen command into a separate bash script. Eg. /tmp/foo.sh
- Put path prefixes in case the screen command is not found. But screen -ls works just fine, so that's not it
- Run screen in non-detached mode, just as a test. This fails as expected with "Must be connected to a terminal.". So this means that screen at least is thinking of doing the right thing.
- Run screen as a LaunchDaemon that i start with a launchctl (create the plist file as OnDemand). Same problem.
Is there some way I can debug what's going on? I can't think of how to figure out why things are not working and I'm completely out of ideas. And I don't see any logs that might help either.
My System is: OSX 10.6.5; screen ver. 4.00.03
Update:
I just thought to look in /var/log/system.log and I see:
Feb 24 23:19:00 macmini2 com.apple.launchd[1] (0x1037c0.anonymous.screen[57291]): Switching sessions is not allowed in the system Mach bootstrap.
Feb 24 23:19:00 macmini2 com.apple.launchd[1] (0x1037c0.anonymous.screen[57291]): _vprocmgr_switch_to_session(): kr = 0x44c
I'm going to have to research this further it seems, but I don't want to go down the path suggested in my first couple of searches for this error, which are to install fink version of screen, or to build screen from source. I'd rather keep the machine as is if at all possible (though I'm not against compiling screen from source if that's the only solution).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经找到了解决我的问题的方法,我怀疑回答我自己的问题是一个不好的协议,但是为了其他可能遇到这个问题的人,这就是我解决这个问题的方法..
最简单/唯一的解决方案似乎是从源代码构建屏幕。步骤非常简单直接:
将这个新屏幕用于所有守护进程或后台进程(例如 Hudson 的 shell 启动器、尝试使用屏幕的 cron'ed 任务等)工作起来非常顺利。这也使系统屏幕(/usr/bin/screen)保持不变。
参考资料:
I've found a solution to my problem, and I suspect it's bad protocol to answer my own question, but for the sake of others who may have this issue, here's how I got around this ..
The easiest/only solution seems to be to build screen from source. Steps are very simple and straight-forward:
Using this new screen for all daemons or background processes (eg. Hudson's shell launcher, cron'ed tasks that try to use screen, etc.) works very smoothly. This also keeps the system screen (/usr/bin/screen) unaltered.
References: