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

Remove | tee $PIPE and systemd-cat #103

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Remove | tee $PIPE and systemd-cat #103

wants to merge 2 commits into from

Conversation

wesbarnett
Copy link
Collaborator

Remove duplication of logs.

Fixes #101.

Remove duplication of logs.

Fixes #101.
@NicoHood
Copy link
Collaborator

Well, this looks trivial. Why was $PIPE even used?

I found this:
e7085c4

I am not sure what the issue is here, is it only to print to stderr?
https://stackoverflow.com/questions/10963653/what-method-should-i-use-to-write-error-messages-to-stderr-using-printf-in-a

@wesbarnett
Copy link
Collaborator Author

They problem I was trying to solve was getting the output to print both to the screen and to the systemd journal, since this can be set to run with a systemd unit.

This sets up $PIPE here:
https://github.com/wesbarnett/snap-sync/blob/master/bin/snap-sync#L41-L43

But, after some searching I think the correct way is to print to stdout/stderr without setting up systemd-cat and then in the systemd unit specify StandardOutput=journal+console

@wesbarnett
Copy link
Collaborator Author

wesbarnett commented Feb 13, 2021

Now it looks like it's not even necessary any more. It looks like the stdout automatically goes to the systemd journal for the unit

The StandardOutput entry for man systemd.exec says:

This setting defaults to the value set with DefaultStandardOutput= in systemd-system.conf(5), which defaults to journal.

So, yep this was all unnecessary to begin with. Will update PR

If this is run by a systemd service, StandardOutput defaults to
journal already, so no need to control that here.
@wesbarnett wesbarnett changed the title Change | tee $PIPE to > $PIPE Remove | tee $PIPE and systemd-cat Feb 13, 2021
@NicoHood
Copy link
Collaborator

That is weird. But didnt you introduce that feature because it did not work before? Why does it work now?

Looks way cleaner though :-)

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

Successfully merging this pull request may close these issues.

Duplicated entries in the systemd service journal
2 participants