You can now start/stop this service with: systemctl start my-service
/ systemctl stop my-service
.
To enable this service when startup, run systemctl enable my-service
.
References: https://transang.me/create-startup-scripts-in-ubuntu/
[Unit] | |
Description=K3s Agent start | |
# After=network.target | |
# After=systemd-user-sessions.service | |
# After=network-online.target | |
[Service] | |
User=root | |
# Type=simple | |
# PIDFile=/run/my-service.pid | |
ExecStart=/usr/local/bin/k3s agent -c /etc/rancher/k3s/agent/config.yaml | |
# ExecReload=/home/transang/startup.sh reload | |
# ExecStop=/home/transang/startup.sh stop | |
# TimeoutSec=30 | |
Restart=on-failure | |
RestartSec=30 | |
# StartLimitInterval=350 | |
# StartLimitBurst=10 | |
[Install] | |
WantedBy=multi-user.target |
[Unit] | |
Description=K3s Server start | |
# After=network.target | |
# After=systemd-user-sessions.service | |
# After=network-online.target | |
[Service] | |
User=root | |
# Type=simple | |
# PIDFile=/run/my-service.pid | |
ExecStart=/usr/local/bin/k3s server -c /etc/rancher/k3s/master/config.yaml | |
# ExecReload=/home/transang/startup.sh reload | |
# ExecStop=/home/transang/startup.sh stop | |
# TimeoutSec=30 | |
Restart=on-failure | |
RestartSec=30 | |
# StartLimitInterval=350 | |
# StartLimitBurst=10 | |
[Install] | |
WantedBy=multi-user.target |
You can now start/stop this service with: systemctl start my-service
/ systemctl stop my-service
.
To enable this service when startup, run systemctl enable my-service
.
References: https://transang.me/create-startup-scripts-in-ubuntu/