0
0

More than 1 year has passed since last update.

jenkins jnlp agentの自動起動・停止

Posted at

1.起動用シェルファイルを作成

/home/ec2-user/jnlpd.sh

#!/bin/bash
cd /home/ec2-user
java -jar agent.jar -jnlpUrl http://172.31.34.77:8080/computer/jnlp/jenkins-agent.jnlp -secret xxxxyyyyzzz -workDir "/home/ec2-user" &

2.unitファイルを作成

/etc/systemd/system/jnlpd.service

[Unit]
Description=jnlp connection daemon
After=network.target

[Service]
SuccessExitStatus=143
Type=forking
User=ec2-user
Group=ec2-user
ExecStart=/home/ec2-user/jnlpd.sh
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=42s

[Install]
WantedBy=multi-user.target

3.サービスをenable・start

sudo systemctl daemon-reload
sudo systemctl enable jnlpd
sudo systemctl start jnlpd
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0