I am familiar with controlling preconfigured system daemons (as packaged by Debian) with the systemctl command. I also have a custom "service" that I start manually with:

sudo process --option

Because it runs with sudo I can't add it to the "Startup" list (that start when I log into my desktop session). In any event, I would prefer to run it:

  • on system startup
  • in the background
  • as root

Ideally I would also like the option to:

  • stop/start it from the command line (with or similarly to systemctl)

In other words, treat it like any other system daemon. How can I configure my custom service to act like a regular, preconfigured one?

  • Well, this is the very basic usage of systemd. – Tomasz Pala Jun 4 '18 at 12:17
  • @TomaszPala I've rephrased the question to make it more obvious that I didn't know that :) – david.libremone Jun 4 '18 at 12:55

Any recent tutorial about systemd will give you the basics about running services with systemd.

# cat /etc/systemd/system/foo.service 



Then activate it:

systemctl daemon-reload
systemctl enable myservice
# Start / Stop
systemctl start myservice
systemctl stop myservice

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.