How can I tell what user Jenkins is running as?

时光怂恿深爱的人放手 提交于 2019-12-10 13:49:39

问题


I have a bitnami Jenkins VM, how do I tell what user Jenkins is running as? I suspect it is Tomcat.


回答1:


I would use ps to get the uid of the process, and grep for that in /etc/passwd




回答2:


You could also create a Jenkins job containing a shell script box with the "whoami" command.




回答3:


Use this command to see under which process your Jenkins server works on:

ps axufwwww | grep 'jenkins\|java' - 

To interpret the results, look for:

jenkins   1087  0.0  0.0  18740   396 ?        S    08:00   0:00 /usr/bin/daemon --name=jenkins
jenkins   1088  1.6 20.7 3600900 840116 ?      Sl   08:00   2:12  \_ /usr/bin/java

1087 and 1088 are the PIDs. They might differ for you.




回答4:


ps aux | grep '/usr/bin/daemon' | grep 'jenkins' | awk {'print $1'}

The command will show running processes, then grep for a process running as a daemon that includes the string 'jenkins'. Finally, get the first row of the piped output which is the user that is running Jenkins.



来源:https://stackoverflow.com/questions/17733671/how-can-i-tell-what-user-jenkins-is-running-as

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!