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

deb: Stop using --wait option of systemctl #526

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

daipom
Copy link
Contributor

@daipom daipom commented Jul 17, 2023

We misunderstood the use of this option.

By default, systemctl status waits until the unit's start-up is completed (without --no-block option).
The option --wait is for blocking systemctl start foobar until the service foobar is stopped.

@daipom
Copy link
Contributor Author

daipom commented Jul 17, 2023

Note: $ man systemctl on Ubuntu 22.04.

       --no-block
           Do not synchronously wait for the requested operation to finish. If this is not specified, the job will be verified, enqueued and systemctl will wait until the unit's start-up is completed. By passing this argument, it is
           only verified and enqueued. This option may not be combined with --wait.
       --wait
           Synchronously wait for started units to terminate again. This option may not be combined with --no-block. Note that this will wait forever if any given unit never terminates (by itself or by getting stopped explicitly);
           particularly services which use "RemainAfterExit=yes".

           When used with is-system-running, wait until the boot process is completed before returning.

Copy link
Member

@ashie ashie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I couldn't understand the document what --wait does, so I read the source code:

aho@Ryzen:~/src/systemd-249.11/src/systemctl$ grep -rn arg_wait
systemctl.c:70:bool arg_wait = false;
systemctl.c:634:                        arg_wait = true;
systemctl.c:937:        if (arg_wait && arg_no_block)
systemctl.c:949:                if (arg_wait)
systemctl-start-unit.c:274:        if (arg_wait && !STR_IN_SET(argv[0], "start", "restart"))
systemctl-start-unit.c:280:        r = acquire_bus(arg_wait ? BUS_FULL : BUS_MANAGER, &bus);
systemctl-start-unit.c:354:        if (arg_wait) {
systemctl-start-unit.c:396:        if (arg_wait) {
systemctl.h:54:extern bool arg_wait;
systemctl-is-system-running.c:44:        if (arg_wait) {
systemctl-is-system-running.c:57:                        arg_wait = false;
systemctl-is-system-running.c:70:        if (arg_wait && STR_IN_SET(state, "initializing", "starting")) {

It's only affected on systemctl start or systemctl is-system-running, not affected to status.

Copy link
Member

@ashie ashie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I've noticed the inappropriate comment in your commit message:

By default, systemctl status waits until the unit's start-up is completed (without --no-block option).
--wait is an option about terminating, and has nothing to do with the start-up.

Could you revise this comment?
The option --wait is for blocking systemctl start foobar until the service foobar is stopped.

We misunderstood the use of this option.

By default, `systemctl status` waits until the unit's start-up is
completed (without `--no-block` option).
The option `--wait` is for blocking `systemctl start foobar` until the
service `foobar` is stopped.

Signed-off-by: Daijiro Fukuda <fukuda@clear-code.com>
@daipom daipom force-pushed the deb-stop-using-systemctl-wait-option branch from 8279389 to e8cadd9 Compare July 18, 2023 00:43
@daipom
Copy link
Contributor Author

daipom commented Jul 18, 2023

Thanks for your review! I see!

The commit message and the issue comment is updated!

Copy link
Member

@ashie ashie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ashie ashie merged commit ac0a5bb into fluent:master Jul 18, 2023
11 checks passed
@daipom daipom deleted the deb-stop-using-systemctl-wait-option branch July 18, 2023 00:47
@daipom
Copy link
Contributor Author

daipom commented Jul 18, 2023

Thanks!

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.

2 participants