Linux Self Hosted Agent Service Configuration
1️⃣ Edit the service file
sudo vi /etc/systemd/system/myagent.service
2️⃣ Update it like this
[Unit]
Description=My Agent Service
After=network.target
[Service]
Type=simple
User=itadmin
WorkingDirectory=/home/itadmin/myagent
ExecStart=/bin/bash /home/itadmin/myagent/run.sh
Restart=always
RestartSec=5
Environment=PATH=/usr/bin:/bin
[Install]
WantedBy=multi-user.target
3️⃣ Reload systemd and restart
sudo systemctl daemon-reload
sudo systemctl restart myagent
4️⃣ Check status again
sudo systemctl status myagent
You should now see:
Active: active (running)