Skip to content

Commit bcceabc

Browse files
authored
Merge pull request systemd#18886 from anitazha/shutdownconsole
logging shutdown to /dev/console
2 parents 87f9300 + 016f36a commit bcceabc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/shutdown/shutdown.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,9 @@ int main(int argc, char *argv[]) {
322322
log_set_prohibit_ipc(true);
323323
log_parse_environment();
324324

325+
if (getpid_cached() == 1)
326+
log_set_always_reopen_console(true);
327+
325328
r = parse_argv(argc, argv);
326329
if (r < 0)
327330
goto error;
@@ -556,8 +559,10 @@ int main(int argc, char *argv[]) {
556559
sync_with_progress();
557560

558561
if (streq(arg_verb, "exit")) {
559-
if (in_container)
562+
if (in_container) {
563+
log_info("Exiting container.");
560564
return arg_exit_code;
565+
}
561566

562567
cmd = RB_POWER_OFF; /* We cannot exit() on the host, fallback on another method. */
563568
}

0 commit comments

Comments
 (0)