Conversation
4b64229 to
967c9e0
Compare
|
Is there a better way for syncing journal files to disk? I think is ugly:) /cc @poettering |
test/TEST-01-BASIC/test.sh
Outdated
There was a problem hiding this comment.
I usually have a slight preference for using /bin/sh instead since this should also work with non-bash shells (e.g. Debian/Ubuntu ship "dash" as a possible alternative) and there are no reasons why that wouldn't work.
The set -x can also be pulled outside:
ExecStart=/bin/sh -x -c 'systemctl --failed --no-legend --no-pager > /failed ; echo OK > /testok'
And last trailing semi-colon is not really necessary anymore.
Otherwise, looks great!
There was a problem hiding this comment.
@filbranden , fixed.
Please, take a look: evverx@7d97774. I like /bin/bash -xc but use /bin/sh -x -c. It's consistent with your style in test-execute
There was a problem hiding this comment.
Looks good, thanks!
One more point of /bin/sh is that we can then use busybox shell, in which case we can aim at a very minimal container that doesn't need to have bash + coreutils to run the experiments on.
Cheers!
Filipe
|
@evverx yeah, there is "journalctl --flush", which waits for the flush to complete... But I figure you found that too, by now? I am a bit confused by the order here... as the original message was updated after some of the comments, right? Patch looks good to me now, everybody else OK with this too? |
|
Regarding /bin/sh vs. /bin/bash: I personally don't really believe in Debian's usage of "dash"... it sounds like an additional source of bugs for no real gain, but well.. Either way, I'd merge it with either /bin/bash or /bin/sh as long as the semaphore thing builds... On my systems both are the same anyway, and i am sure that folks who run into problems with it, will yell if it does break things... Anyway, would be good to get feedback from @ronnychevalier, @martinpitt as @evverx requested, before we merge this. |
I need a BTW
https://wiki.ubuntu.com/DashAsBinSh
https://wiki.debian.org/Shell
|
|
Hmm, @poettering since you added this feature, why this file is not removed afterward? Or maybe, this switch is meant to be used only once? (which would be contradictory with what the man page says) because nowhere in the journal we remove this file, so after Or maybe i'm missing something? |
|
hmm? "journalctl --flush" is about flushing the journal data from /run to /var, which is really a one-time operation. The command only sends a SIGUSR1 when invoked the first time. If the flush already took place it becomes a NOOP. As such it is idempotent: whenever you run it, you can be sure that afterwards the log data is in /var, if things are configured that way. |
|
@evverx what precisely are you looking for? just a way to get the journal files into a clean state? There's no nice way for this, all ways are necessarily racy, since any log message will immediately cause the files to be marked dirty again... What's precisely needed here? what exactly do you want journald to do for you? |
|
Ok, just a misunderstanding from my part, thanks :) |
I want If I have a Should be (note |
|
I mean, I want 'save' |
|
let me get this right. All you want to do is ensure that the journal picked up everything written to stdout/stderr of testsuite.serivce and wrote it to disk? i.e. an operation one could well describe as a "sync"? Why precisely do you need this? I mean, when shutting down, we'll sync things anyway... why does that not suffice? I figure to support this properly we could intrdouce a new flag file "/run/systemd/journal/sync" or so that is touched each time systemd has synced all files to disk. Then, let's add a new sync signal to journald (for example SIGRTMIN+1), which will result in a sync of all files, and thus the date being updated on /run/systemd/journal/sync. If all files where already synced it would nonetheless touch the sync file. Then, in journalctl let's add a new --sync verb: it would get the current time, send the signal, and then wait with inotify until the mtime of the sync file is newer than the time it sent the signal. That way by invoking "journalctl --sync" we'd have reliable way to know that everything that was logged before invoking it has hit the disk, after it returns. @evverx does that make sense to you? |
I don't know why but it doesn't work for me. I always lose the output of the Hm, |
Yes. |
There is an option SyncIntervalSec=:
Will it update Anyway,
We can replace it later. |
Let's make sure to process all queued log data before exiting, so that we don't unnecessary lose messages when shutting down. systemd#1812 (comment)
* remove journal flushing (systemd-journal-flush.service runs journalctl --flush on boot) * use sh -c and PATH instead of @systemctl@ expansion * remove unnecessary semicolons etc
|
I rebased my commit on your branch, removed syncing, run @poettering , yes, that works for me. Thanks! |
|
OK, merged this one now. Of course, this will only be complete if #1835 is merged too. |
|
@poettering , thanks. I'll take a look. |
Let's make sure to process all queued log data before exiting, so that we don't unnecessary lose messages when shutting down. systemd/systemd#1812 (comment) Cherry-picked from: b374689 Related: #1318994
Let's make sure to process all queued log data before exiting, so that we don't unnecessary lose messages when shutting down. systemd/systemd#1812 (comment) Cherry-picked from: b374689 Related: #1318994
Let's make sure to process all queued log data before exiting, so that we don't unnecessary lose messages when shutting down. systemd/systemd#1812 (comment) Cherry-picked from: b374689c02c681671a3c3c0b0fd3add32386b442 Related: #1318994
add journal syncing to the end.service(see poettering@b374689)@ronnychevalier , please, take a look.
@martinpitt , I removed that commit. Is it ok?