summaryrefslogtreecommitdiff
path: root/src/systemctl/systemctl-logind.c
diff options
context:
space:
mode:
authorLudwig Nussel <ludwig.nussel@suse.de>2022-01-05 13:17:50 +0100
committerLudwig Nussel <ludwig.nussel@suse.de>2022-01-10 09:09:50 +0100
commit8e98568165ee3db049160045d94ce030dc7fbb79 (patch)
tree76ba8f27cb52318b3893cb328f5f38c06857b92a /src/systemctl/systemctl-logind.c
parent2dbb54788ee8d4c3d84e1af309335ad3c3885f1a (diff)
downloadsystemd-8e98568165ee3db049160045d94ce030dc7fbb79.tar.gz
systemctl: consistent output for scheduled shutdowns
Use same terms when scheduling and showing sheduled shutdowns.
Diffstat (limited to 'src/systemctl/systemctl-logind.c')
-rw-r--r--src/systemctl/systemctl-logind.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/systemctl/systemctl-logind.c b/src/systemctl/systemctl-logind.c
index 114641cdc7..9eae59ca31 100644
--- a/src/systemctl/systemctl-logind.c
+++ b/src/systemctl/systemctl-logind.c
@@ -297,7 +297,6 @@ int logind_schedule_shutdown(void) {
#if ENABLE_LOGIND
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
const char *action;
- const char *log_action;
sd_bus *bus;
int r;
@@ -308,24 +307,19 @@ int logind_schedule_shutdown(void) {
switch (arg_action) {
case ACTION_HALT:
action = "halt";
- log_action = "Shutdown";
break;
case ACTION_POWEROFF:
action = "poweroff";
- log_action = "Shutdown";
break;
case ACTION_KEXEC:
action = "kexec";
- log_action = "Reboot via kexec";
break;
case ACTION_EXIT:
action = "exit";
- log_action = "Shutdown";
break;
case ACTION_REBOOT:
default:
action = "reboot";
- log_action = "Reboot";
break;
}
@@ -339,9 +333,8 @@ int logind_schedule_shutdown(void) {
return log_warning_errno(r, "Failed to call ScheduleShutdown in logind, proceeding with immediate shutdown: %s", bus_error_message(&error, r));
if (!arg_quiet)
- log_info("%s scheduled for %s, use 'shutdown -c' to cancel.",
- log_action,
- FORMAT_TIMESTAMP_STYLE(arg_when, arg_timestamp_style));
+ logind_show_shutdown();
+
return 0;
#else
return log_error_errno(SYNTHETIC_ERRNO(ENOSYS),
@@ -396,6 +389,13 @@ int logind_show_shutdown(void) {
if (isempty(action))
return log_error_errno(SYNTHETIC_ERRNO(ENODATA), "No scheduled shutdown.");
+ if (streq(action, "halt") || streq(action, "poweroff") || streq(action, "exit"))
+ action = "Shutdown";
+ else if (streq(action, "kexec"))
+ action = "Reboot via kexec";
+ else if (streq(action, "reboot"))
+ action = "Reboot";
+
log_info("%s scheduled for %s, use 'shutdown -c' to cancel.",
action,
FORMAT_TIMESTAMP_STYLE(elapse, arg_timestamp_style));