没有连接到詹金斯 - 从运行上launchDaemon MAC bash脚本 [英] Bash script running from launchDaemon on MAC - not connecting to jenkins
问题描述
我有这应该是运行我的脚本很简单的plist文件:
I've got very simple plist file which is supposed to run my script:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.example.ci</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>/Users/Shared/Jenkins/Home/my_scripts/run_jenkins.sh</string>
</array>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/Users/Shared/Jenkins/Home/stdout.log</string>
<key>StandardErrorPath</key>
<string>/Users/Shared/Jenkins/Home/error.log</string>
</dict>
</plist>
当我运行它没有任何反应 - 我的意思是,当我运行 SH run_jenkins.sh
它连接到我的服务器詹金斯。但是,当我从 sudo的launchctl org.jenkins-ci.plist运行
那么它不连接。我缺少的东西吗?
and when I run it nothing happens - I mean when I run sh run_jenkins.sh
it connects to my jenkins server. But when I run it from sudo launchctl org.jenkins-ci.plist
then it doesn't connect. Am I missing something?
推荐答案
您缺少的负荷或launchctl start命令:
You are missing the "load" or start command in the launchctl:
sudo launchctl load -w org.jenkins-ci.plist
sudo launchctl start org.jenkins-ci.plist
您应该也可能使你的脚本可执行文件,使用
You should probably also make your script executable, using
chmod +x "/Users/Shared/Jenkins/Home/my_scripts/run_jenkins.sh"
和删除sh的线在你的plist文件。
And remove the "sh" line in your plist file.
,并确保您的脚本以正确的家当行启动:
And make sure your script starts with the correct shebang line:
#!/bin/sh
和设置您的plist文件的权限:
And set the permissions on your plist file:
chmod 644 org.jenkins-ci.plist
这篇关于没有连接到詹金斯 - 从运行上launchDaemon MAC bash脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!