Skip to content

Conversation

@wesbarnett
Copy link
Collaborator

Remove duplication of logs.

Fixes #101.

Remove duplication of logs.

Fixes #101.
@wesbarnett wesbarnett requested a review from NicoHood February 7, 2021 14:39
@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

3 participants