Take a look under /etc/systemd/system/ This is a good place to put custom system files.
You’ll want to add your new foobar.service file here, then run systemctl daemon-reload or systemctl reload foobar to make systemd load the new config file. Then you can run systemctl start foobar and so on.
The rest is up to you and the published docs for the system file itself. My recommendation is to also try to understand daemons you may already use like nginx, apache, postgresql, etc. Their configs can be found by first running systemctl status <servicename> and to look at the Loaded: line. Most of the packaged stuff is hanging out under /lib/systemd/system.
It’s been a hot minute, but here’s what I recall.
Take a look under
/etc/systemd/system/
This is a good place to put custom system files.You’ll want to add your new
foobar.service
file here, then runsystemctl daemon-reload
orsystemctl reload foobar
to make systemd load the new config file. Then you can runsystemctl start foobar
and so on.The rest is up to you and the published docs for the system file itself. My recommendation is to also try to understand daemons you may already use like nginx, apache, postgresql, etc. Their configs can be found by first running
systemctl status <servicename>
and to look at theLoaded:
line. Most of the packaged stuff is hanging out under/lib/systemd/system
.