Unrecognised Service for existing, working service - Ubuntu 18.04
Solution 1:
Use the real command, which for systemd
would be:
sudo systemctl enable my-service
For reference, you do not have to use the main system directory for the unit file if you want it to run for a normal user, e.g. your own. You can create it in a directory such as:
~/.config/systemd/user/
Then you can do:
systemctl --user enable my-service
This avoids the need for sudo
As you have noted in your comment, when running per-user instances of systemd
the User
directive should be absent
Solution 2:
Note:
In other instances that you get the same error:
The service
command puts the object first !
service foo start
The systemctl
command does the opposite:
systemctl start foo
Also, in service, you cannot add ".service", while you can if you use systemctl.