[systemd-devel] start/stop messages when activating a target?

Andrey Borzenkov arvidjaar at gmail.com
Wed Jun 12 05:13:44 PDT 2013


В Wed, 12 Jun 2013 12:39:00 +0100
Colin Guthrie <gmane at colin.guthr.ie> пишет:

> [ Please try to avoid top posting and HTML emails if possible!]
> 
> 
> 'Twas brillig, and Umut Tezduyar at 12/06/13 07:39 did gyre and gimble:
> > On Wed, Jun 12, 2013 at 5:02 AM, Andrey Borzenkov <arvidjaar at gmail.com
> > <mailto:arvidjaar at gmail.com>> wrote:
> > 
> >     В Wed, 12 Jun 2013 01:32:37 +0200
> >     Michael Olbrich <m.olbrich at pengutronix.de
> >     <mailto:m.olbrich at pengutronix.de>> пишет:
> > 
> >     > Hi,
> >     >
> >     > When booting or during shutdown systemd prints the start stop
> >     messages for
> >     > the services. Is it possible to get those messages when activating
> >     a target
> >     > with systemctl?
> >     >
> > 
> >     systemctl already prints status of job unless called with --no-block.
> >     Do you want additional status messages on console?
> 
> > Same thing with isolating a target. Job statuses are not printed out on
> > the console and it would be great to see what is being stopped/started
> > at which order for debugging.
> 
> This was discussed very recently on this list, but I forget the exact
> message. Lennart thought it would be tricky due to the async nature, but
> with the standard --no-block behaviour I think this could be achievable
> (and very useful).
> 

Actually in this case it looks relatively trivial.

---
 src/systemctl/systemctl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 3cca861..aa37b7a 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -1580,7 +1580,11 @@ static int wait_for_jobs(DBusConnection *bus, Set *s) {
                                 log_error("Job for %s canceled.", strna(d.name));
                         else if (streq(d.result, "dependency"))
                                 log_error("A dependency job for %s failed. See 'journalctl -xn' for details.", strna(d.name));
-                        else if (!streq(d.result, "done") && !streq(d.result, "skipped"))
+                        else if (streq(d.result, "done"))
+                                log_info("Job for %s completed.", strna(d.name));
+                        else if (streq(d.result, "skipped"))
+                                log_info("Job for %s skipped.", strna(d.name));
+                        else
                                 log_error("Job for %s failed. See 'systemctl status %s' and 'journalctl -xn' for details.", strna(d.name), strna(d.name));
                 }
 
-- 
tg: (12f25b6..) systemctl/job_status (depends on: master)


More information about the systemd-devel mailing list