jenkins在mac系统中日志、配置、启动文件的路径与其它系统有所差异
启动、停止命令路径
开机启动配置文件位置
/Library/LaunchDaemons/org.jenkins-ci.plist
启动命令所在位置
/Library/Application Support/Jenkins/jenkins-runner.sh
/Library/Application Support/Jenkins/Uninstall.command
停止启动jenkins
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
# 也可以在浏览器中以链接的方式停止、重启jenkins
http://localhost:8080/exit
http://localhost:8080/restart
http://localhost:8080/reload
日志文件位置
/var/log/jenkins/jenkins.log
配置文件路径:
/etc/newsyslog.d/jenkins.conf
工作目录路径:
/Users/Shared/Jenkins/
禁止开机启动
launchctl unload -w /Library/LaunchDaemons/org.jenkins-ci.plist
修改jenkins默认端口
#add the default parameters - this will edit /Library/Preferences/org.jenkins-ci.plist
sudo defaults write /Library/Preferences/org.jenkins-ci httpPort 9090
#stop
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
#start
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
异常及解决办法
Getting `Can‘t assign requested address` java.net.SocketException using Ehcache multicast
解决上边的异常我们需要修改文件/Library/Application Support/Jenkins/jenkins-runner.sh
,修改内容如下:
echo /usr/bin/java $javaArgs -jar "$war" $args
exec /usr/bin/java $javaArgs -jar "$war" $args
修改为:
echo /usr/bin/java -Djava.net.preferIPv4Stack=true $javaArgs -jar "$war" $args
exec /usr/bin/java -Djava.net.preferIPv4Stack=true $javaArgs -jar "$war" $args
构建时报错:
Host deploy@xx.xx.xx.xx not found in /Users/Shared/Jenkins/.ssh/known_hosts
+ ssh -t -t deploy@xx.xx.xx.xx sudo service myapp stop
Host key verification failed.
Build step ‘Execute shell‘ marked build as failure
Finished: FAILURE
解决办法:
将当前登录用户的~/.ssh
目录下的id_rsa, id_rsa.pub, know_hosts
拷贝到/Users/Shared/Jenkins/.ssh/
目录下,并修改权限和组为jenkins:jenkins
cp ~/.ssh/id_rsa /Users/Shared/Jenkins/.ssh/
cp ~/.ssh/id_rsa.pub /Users/Shared/Jenkins/.ssh/
cp ~/.ssh/know_hosts /Users/Shared/Jenkins/.ssh/
chown -R jenkins:jenkins /Users/Shared/Jenkins/.ssh/