Created
November 10, 2018 11:20
-
-
Save unakatsuo/d4711f52a0ab0b9bc8010018149a7e84 to your computer and use it in GitHub Desktop.
systemd Jenkins JNLP Slave service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JENKINS_URL=http://192.168.1.57:8080 | |
JENKINS_WORKSPACE=/home/jenkins/workspace | |
JENKINS_NODE=node1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Place to /etc/systemd/system/ or /usr/lib/systemd/system/. | |
[Unit] | |
Description=Jenkins JNLP Slave service | |
After=network.target | |
[Service] | |
Type=simple | |
Environment=LANG=C | |
EnvironmentFile=-/etc/sysconfig/jenkins-slave | |
WorkingDirectory=${JENKINS_WORKSPACE} | |
ExecStartPre=/usr/bin/curl --fail -s -o ${JENKINS_WORKSPACE}/slave.jar ${JENKINS_URL}/jnlpJars/slave.jar | |
ExecStart=/usr/bin/java -jar ${JENKINS_WORKSPACE}/slave.jar -jnlpUrl ${JENKINS_URL}/computer/${JENKINS_NODE}/slave-agent.jnlp | |
Restart=on-failure | |
RestartSec=30s | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cool, many thanks.
I tried implementing that but it seems that WorkingDirectory does not allow variables :(