static bool arg_defaults = false;
static char **arg_wall = NULL;
static usec_t arg_when = 0;
-static bool arg_skip_fsck = false;
-static bool arg_force_fsck = false;
static enum action {
ACTION_INVALID,
ACTION_SYSTEMCTL,
if (d1 && d2) {
int r;
- if ((r = strcmp(d1, d2)) != 0)
+ if ((r = strcasecmp(d1, d2)) != 0)
return r;
}
- return strcmp(u->id, v->id);
+ return strcasecmp(u->id, v->id);
}
static int list_units(DBusConnection *bus, char **args, unsigned n) {
if (isatty(STDOUT_FILENO)) {
- printf("\nLOAD = Load State, reflects whether the unit configuration was properly loaded.\n"
- "ACTIVE = Active State, the high-level unit activation state, i.e. generalization of the substate.\n"
- "SUB = Substate, the low-level unit activation state, possible values depend on unit type.\n"
- "JOB = Job, shows pending jobs for the unit.\n");
+ printf("\nLOAD = Reflects whether the unit definition was properly loaded.\n"
+ "ACTIVE = The high-level unit activation state, i.e. generalization of SUB.\n"
+ "SUB = The low-level unit activation state, values depend on unit type.\n"
+ "JOB = Pending job for the unit.\n");
if (arg_all)
printf("\n%u units listed.\n", c);
static int shutdown_help(void) {
- printf("%s [OPTIONS...] [now] [WALL...]\n\n"
+ printf("%s [OPTIONS...] [TIME] [WALL...]\n\n"
"Shut down the system.\n\n"
" --help Show this help\n"
" -H --halt Halt the machine\n"
" -h Equivalent to --poweroff, overriden by --halt\n"
" -k Don't halt/power-off/reboot, just send warnings\n"
" --no-wall Don't send wall message before halt/power-off/reboot\n"
- " -f Skip fsck on reboot\n"
- " -F Force fsck on reboot\n"
" -c Cancel a pending shutdown\n",
program_invocation_short_name);
return -EINVAL;
n = now(CLOCK_REALTIME);
- s = (time_t) n / USEC_PER_SEC;
+ s = (time_t) (n / USEC_PER_SEC);
+
+ zero(tm);
assert_se(localtime_r(&s, &tm));
tm.tm_hour = (int) hour;
tm.tm_min = (int) minute;
+ tm.tm_sec = 0;
assert_se(s = mktime(&tm));
/* Compatibility nops */
break;
- case 'f':
- arg_skip_fsck = true;
- break;
-
- case 'F':
- arg_force_fsck = true;
- break;
-
case 'c':
arg_action = ACTION_CANCEL_SHUTDOWN;
break;
return r;
}
} else
- arg_when = USEC_PER_MINUTE;
+ arg_when = now(CLOCK_REALTIME) + USEC_PER_MINUTE;
/* We skip the time argument */
if (argc > optind + 1)
return -EPERM;
}
- if (arg_force_fsck) {
- if ((r = touch("/forcefsck")) < 0)
- log_warning("Failed to create /forcefsck: %s", strerror(-r));
- } else if (arg_skip_fsck) {
- if ((r = touch("/fastboot")) < 0)
- log_warning("Failed to create /fastboot: %s", strerror(-r));
- }
-
if (arg_when > 0) {
char *m;
+ char date[FORMAT_TIMESTAMP_MAX];
m = strv_join(arg_wall, " ");
r = send_shutdownd(arg_when,
if (r < 0)
log_warning("Failed to talk to shutdownd, proceeding with immediate shutdown: %s", strerror(-r));
- else
+ else {
+ log_info("Shutdown scheduled for %s, use 'shutdown -c' to cancel.",
+ format_timestamp(date, sizeof(date), arg_when));
return 0;
+ }
}
if (!arg_dry && !arg_immediate)
dbus_error_init(&error);
log_parse_environment();
+ log_open();
if ((r = parse_argv(argc, argv)) < 0)
goto finish;