本來我沒有找到類似於gerrit的啓動腳本
但是萬能的google告訴了我,人家官網上提供了……
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+as+a+Unix+daemon
以及
https://wiki.jenkins-ci.org/display/JENKINS/JenkinsLinuxStartupScript我覺得可以參考下面這種方法:
Java Service Wrapper
The The Java Service wrapper is a wrapper that works both on Unix and Windows. It requires some set up but when it is setup it can be used as any other unix service (like start/stop).
This example will install a Jenkins instance in /home/jenkins on a debian machine. The Jenkins configuration is stored in /home/jenkins/data. Jenkins will be running on port 8070 and as the jenkins user.
- Select and download a JSW package from the JSW wrapper download page.
- Unpack the package into the /home/jenkins path.
- Create /home/jenkins/tmp as the temporary directory for JSW.
- Download the jenkins.war file into /home/jenkins/lib.
- If you have plugins that you would like to use, download them into /home/jenkins/data/plugins.
- Copy the /home/jenkins/src/conf/wrapper.conf.in to /home/jenkins/conf/wrapper.conf and change the below configuration properties in the file.
- Verify the wrapper configuration by starting Jenkins through /home/jenkins/bin/testwrapper console. Jenkins should be accessible through http://localhost:8070, if not check the console output for errors.
- Copy the /home/jenkins/src/bin/sh.script.in to /etc/init.d/jenkins and change the below configuration properties in the file.
- Verify installation by starting the daemon through /etc/init.d/jenkins start. Make sure that /etc/init.d/jenkins has the correct permissions; normally 755 is ok for this.
照着上面的改的,RUN_AS_USER我就用的自己的用戶
然後系統啓動起來之後jenkins的服務啓動的較慢,可能要等一分鐘。
不過,自動啓動是驗證過了OK了,可以用了