Bug#923964: systemd-sysv: shutdown should accept a date

Barak A. Pearlmutter barak at pearlmutter.net
Thu Mar 7 17:39:58 GMT 2019


Package: systemd-sysv
Version: 241-1
Severity: wishlist

Dear Maintainer,

Thanks to the diligent effort of people like yourself, my Debian
computers usually run without rebooting for months and sometimes even
years.

But sometimes some external issue, like a scheduled power outage,
mandates a clean scheduled shut down. This just happened to me: there is
a scheduled power outage at my workplace at 04:00 about two weeks from
today, so I need to power down a handful of machines beforehand.

Naturally I’d wish to

$ sudo shutdown --poweroff '2019-03-19 03:00'

But that doesn’t work, shutdown only accepts a time, or a delay in
minutes. Instead I end up converting the delay to minutes:

$ sudo shutdown --poweroff +$(echo "($(date --date='2019-03-19 03:00' '+%s') - $(date '+%s')) / 60" | bc)

Yuck. The shutdown executable (which is just a symlink to systemctl, so
in fact already links to date parsing routines) really should take a
proper date string.

Perhaps this functionality can be accessed with "systemctl poweroff
--some-option=TIMESPEC", although I didn’t see it in systemctl(1). It
might make sense to add that, either the option or the documentation. It
might also make sense for shutdown(1) to mention "systemctl shutdown".



More information about the Pkg-systemd-maintainers mailing list