Skip to content

Commit

Permalink
systemctl: list-jobs: interchange 'waiting for' and 'blocking' in output
Browse files Browse the repository at this point in the history
The current output of 'systemctl list-jobs' with the --after and/or --before
switches seems backwards. With artificial units

# check-oil.service
[Unit]
Description=Check the oil level
Before=engine-ready.target

# fill-gas.service
[Unit]
Description=Fill the tank with gasoline
Before=engine-ready.target

# engine-ready.target
[Unit]
Description=The engine is ready

[Unit]
Description=Start the engine!
After=engine-ready.target
Wants=engine-ready.target

running 'systemctl list-jobs --before --after' produces

JOB UNIT                                              TYPE  STATE
93  check-oil.service                                 start running
└─      waiting for job 94 (engine-ready.target/start)   -     -
102 fill-gas.service                                  start running
└─      waiting for job 94 (engine-ready.target/start)   -     -
94  engine-ready.target                               start waiting
└─      waiting for job 111 (start-engine.service/start) -     -
└─      blocking job 93 (check-oil.service/start)        -     -
└─      blocking job 102 (fill-gas.service/start)        -     -
111 start-engine.service                              start waiting
└─      waiting for job 1 (multi-user.target/start)      -     -
└─      blocking job 94 (engine-ready.target/start)      -     -

Obviously, job 93 is not waiting for job 94, but rather blocking it.

(cherry picked from commit dc3058e)
(cherry picked from commit bf3e64f)
  • Loading branch information
Villemoes authored and bluca committed May 9, 2024
1 parent 37662f9 commit a0d974a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/systemctl/systemctl-list-jobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ static int output_jobs_list(sd_bus *bus, const struct job_info* jobs, unsigned n
return table_log_add_error(r);

if (arg_jobs_after)
output_waiting_jobs(bus, table, j->id, "GetJobAfter", "\twaiting for job");
output_waiting_jobs(bus, table, j->id, "GetJobAfter", "\tblocking job");
if (arg_jobs_before)
output_waiting_jobs(bus, table, j->id, "GetJobBefore", "\tblocking job");
output_waiting_jobs(bus, table, j->id, "GetJobBefore", "\twaiting for job");
}

r = table_print(table, NULL);
Expand Down

0 comments on commit a0d974a

Please sign in to comment.