Add needed user:
# useradd -m -U jenkins
Enable Service:
# systemctl enable --now jenkins-agent.service
#/home/jenkins/agent.cfg | |
-jnlpUrl | |
https://<MASTER_DOMAIN_HERE>/computer/<AGENT_NAME_HERE>/slave-agent.jnlp | |
-secret | |
<SECRET_HASH_HERE> |
#/etc/systemd/system/jenkins-agent.service | |
[Unit] | |
Description=Jenkins Agent | |
Wants=network-online.target | |
After=network-online.target | |
[Service] | |
Type=simple | |
User=jenkins | |
SyslogIdentifier=jenkins-agent | |
Restart=always | |
RestartSec=120 | |
StartLimitInterval=666 | |
StartLimitBurst=5 | |
Nice=5 | |
SuccessExitStatus=143 | |
Environment=WORK_DIR=/home/jenkins | |
Environment=JENKINS_URL=https://<MASTER_DOMAIN_HERE> | |
Environment="JAVA_OPTS=-Djava.awt.headless=true -Xms64M -Xmx1G" | |
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl" | |
ExecStartPre=/usr/bin/wget -nv ${JENKINS_URL}/jnlpJars/agent.jar -O ${WORK_DIR}/agent.jar | |
ExecStart=/usr/bin/java -jar ${WORK_DIR}/agent.jar -workDir ${WORK_DIR} @${WORK_DIR}/agent.cfg | |
[Install] | |
WantedBy=multi-user.target |