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

Linux/Systemd - Not installed service returns 'inactive' instead #201

Open
bt opened this issue Dec 21, 2019 · 0 comments
Open

Linux/Systemd - Not installed service returns 'inactive' instead #201

bt opened this issue Dec 21, 2019 · 0 comments

Comments

@bt
Copy link

bt commented Dec 21, 2019

I noticed that in https://github.com/kardianos/service/blob/master/service_systemd_linux.go#L218 when checking for Status() of a service that's not installed, it returns inactive instead.

I'm running this on Ubuntu server and here is example output:

$ systemctl is-active asd
inactive
$ systemctl is-active asfdsafdsad
inactive

Both asd and asfdsafdsad are not valid services, so they shouldn't be returning inactive. Therefore it's not possible to check whether a service is installed or not -- ie. it's not possible to get ErrNotInstalled.

I'm not sure if there's a workaround at this time but I'll investigate. Potentially we might have to fallback to checking whether such file exists in /etc/systemd/system if the response from systemd is inactive?

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

1 participant