0

I have my own app and want it to work as a service. It doesn't require any root permissions. I just want to be able to start it, to terminate gracefully (e.g., SIGINT – a few seconds wait – SIGKILL), to restart if it fails once per hour, to get status – all of this systemd does with services. There is no need to start it when OS starts, no need to include it in all services list.

The restriction is that it must not require root privileges, and should not be installed in system somehow (or, at least, be very non-invasive into system).

I managed to make it work if it placed in ~/.config/systemd/user/loved.service: systemctl --user link ~/loved.service. But it's desirable to run it directly from app folder.

I believe systemctl could be used for such cases like this:

systemctl --user start ~/loved.service

When I run this, I get:

Failed to start ....mount: Unit ....mount not found.

Of course, mounting is not what I wanted.

How do I accomplish that?

2

The syntax to start a user service with systemd is just:

systemctl --user start service-name

systemd will look in ~/.config/systemd/user for matching files.

  • Can it take *.service files from custom locations? – George Sovetov Jul 30 '18 at 14:28
  • You can use systemctl link PATH to link a file outside the search path into the search path. See man systemctl for details. – Mark Stosberg Jul 30 '18 at 14:55

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.