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

What needs to be done on a non-systemd system? #108

Open
tleydxdy opened this issue May 17, 2021 · 7 comments
Open

What needs to be done on a non-systemd system? #108

tleydxdy opened this issue May 17, 2021 · 7 comments

Comments

@tleydxdy
Copy link

Hi, I want to use this on an non-systemd system, any pointers as to areas I need to change to make it not depend on systemd?

@Barbaross93
Copy link

I looked into a bit and it's literally only one line: line 42 calling systemd-cat. Just change that to w/e sends logs to syslog for you. I think logger is the typical command as it works for me on a runit based system, but I don't know if that is true for all inits besides systemd.

@wesbarnett If you'd like, I could make a PR for you. I'd simply add the command ps h -p 1 -o cmd to get the name of the command of process 1 which is always (or should always) be the init system, and then do a check for different inits and execute the appropriate logging command.

@tleydxdy
Copy link
Author

tleydxdy commented Sep 5, 2021

don't systemd already handles logging from stdout/stderr?

@Barbaross93
Copy link

I do not know, but assuming that systemd does, my guess is that @wesbarnett wanted systemd to log it with the specified tag "snap-sync" presumably to make it easier to grep for problems. Otherwise (again, just guessing) systemd doesn't log it with any clear distinction.

@tleydxdy
Copy link
Author

tleydxdy commented Sep 5, 2021

upon further thought, why would it log to systemd at all? isn't printing out of stderr enough?

@Barbaross93
Copy link

That's a good question. I think printing to stderr might get garbled with stdout, but redirecting to a separate log file makes the most sense to me in terms of keeping the script init system agnostic.

@tleydxdy
Copy link
Author

stderr and stdout won't affect each other, what do you mean?

@Barbaross93
Copy link

... good catch, had a brain fart there. I think my rationale was that it would be outputted on the terminal with the stdout, but you could easily just redirect stderr to a log file while keeping stdout on the terminal

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