Skip to content

Run as service on Debian based distro

Using systemd

Warning

Make sure to follow the instructions to install from binary before.

To create a new service, paste this content in /etc/systemd/system/swarm-cronjob.service:

[Unit]
Description=swarm-cronjob
Documentation=https://crazymax.dev/swarm-cronjob/
After=syslog.target
After=network.target

[Service]
RestartSec=2s
Type=simple
User=swarmcronjob
Group=swarmcronjob
ExecStart=/usr/local/bin/swarm-cronjob
Restart=always
#Environment=TZ=Europe/Paris

[Install]
WantedBy=multi-user.target

Change the user, group, and other required startup values following your needs.

Enable and start swarm-cronjob at boot:

sudo systemctl enable swarm-cronjob
sudo systemctl start swarm-cronjob

To view logs:

journalctl -fu swarm-cronjob.service

Last update: 2021-09-05 14:56:01
Created: 2020-09-21 23:07:39