Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use systemd to Start a Linux Service at Boot #3142

Open
Rajakavitha1 opened this issue Feb 18, 2020 · 1 comment
Open

Use systemd to Start a Linux Service at Boot #3142

Rajakavitha1 opened this issue Feb 18, 2020 · 1 comment

Comments

@Rajakavitha1
Copy link
Collaborator

Validate and update the guide based on a suggestion in Disqus:
Just a detail - you do NOT need to add myservice.service definition in /lib/systemd/... since those are intended to be for rmp/apt or other package manager installations.

@trey-jones
Copy link

trey-jones commented May 11, 2020

I came here from the comment on Disqus. I wanted to add a bit of information if this gets revisited, since it's still open:

  1. I agree that adding custom service files to /lib/systemd is wrong and /etc/systemd is correct. I used to do that.
  2. However, equally acceptable, and possibly preferable is to store unit files with your application. Calling systemctl enable /path/to/my.service will still create the correct symlink if an Install section is present in the unit file. Or if not, systemctl link /path/to/my.service will symlink into /etc/systemd/system. This can save a step in deployment if you update your unit file. I also think it's appropriate for the unit file to live in the application, but I believe this is personal preference and not necessarily best practice.
  3. To add further, Units that belong to a package or the system should be modified not by editing the file in /lib/systemd, but rather by using systemctl edit foo where foo is the name of the service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants