Some info https://blog.thewatertower.org/2019/04/24/modifying-systemd-unit-files/
systemctl start mydaemon.service
systemctl stop mydaemon.service
systemctl enable mydaemon.service
systemctl disable mydaemon.service
sudo touch /etc/systemd/system/mydaemon.service
sudo nano /etc/systemd/system/mydaemon.service
Bare minimum
[Unit]
Description=My daemon
[Service]
ExecStart=/usr/bin/mydaemon
Restart=on-failure
[Install]
WantedBy=multi-user.target
Detailed
[Unit]
Description=ServiceName
After=syslog.target
After=network.target
After=nginx.service
After=mysql.service
Requires=mysql.service
Wants=redis.service
[Service]
Type=forking # OR simple(default)
PIDFile=/work/www/myunit/shared/tmp/pids/service.pid
WorkingDirectory=/work/www/myunit/current
User=name
Group=name
Environment=RACK_ENV=production
#don't stop service when ran out of memory
OOMScoreAdjust=-1000
ExecStart=/usr/local/bin/bundle exec service -C /work/www/myunit/shared/config/service.rb --daemon
ExecStop=/usr/local/bin/bundle exec service -S /work/www/myunit/shared/tmp/pids/service.state stop
ExecReload=/usr/local/bin/bundle exec service -S /work/www/myunit/shared/tmp/pids/service.state restart
TimeoutSec=300
Restart=on-failure
[Install]
WantedBy=multi-user.target