4

jenkins任务执行的时候会报 XXX command not found

 3 years ago
source link: http://quangelab.com/jenkins-command-not-found/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

jenkins任务执行的时候会报 XXX command not found

###问题排查

/usr/bin 目录下是否有你使用的程序

如果没有的话

sudo ln -s /home/git/.rbenv/versions/2.1.8/bin/rspec /usr/bin/rspec

创建软连接

由于jenkins默认使用的是jenkins用户执行任务,所有可能你的程序对jenkins用户没有权限

修改jenkins执行用户

vi /etc/sysconfig/jenkins

修改JENKINS_USER值:

## Type:        string
## Default:     "jenkins"
## ServiceRestart: jenkins
#
# Unix user account that runs the Jenkins daemon
# Be careful when you change this, as you need to update
# permissions of $JENKINS_HOME and /var/log/jenkins.
#
JENKINS_USER="git"

修改目录的相应权限:

sudo chown -R git /var/log/jenkins 
sudo chgrp -R git /var/log/jenkins

sudo chown -R git /var/lib/jenkins  
sudo chgrp -R git /var/lib/jenkins

sudo chown -R git /var/cache/jenkins 
sudo chgrp -R git /var/cache/jenkins

重启jenkins服务

sudo /etc/init.d/jenkins restart
sudo service jenkins restart
Written on October 28, 2016

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK