4747
4848if @SBINDIR@/upsmon -K > /dev/null 2>&1 ; then
4949 if [ -x " @SBINDIR@/upsdrvctl" ] ; then
50- $POWEROFF_QUIET || echo " $0 : Commanding UPSes (if any) to shutdown" >&2
50+ $POWEROFF_QUIET || {
51+ echo " $0 : Commanding UPSes (if any) to shutdown" >&2
52+ [ -w /dev/console ] && echo " ` TZ=UTC LANG=C date` : $0 : Commanding UPSes (if any) to shutdown" > /dev/console || true
53+ }
5154 @SBINDIR@/upsdrvctl shutdown || echo " $0 : Something failed about UPS shutdown commands" >&2
5255 fi
5356
@@ -58,14 +61,20 @@ if @SBINDIR@/upsmon -K >/dev/null 2>&1; then
5861 # Sleep "long enough" to drain the battery if the UPS is
5962 # in fact on battery, or reboot if it became alive, so
6063 # this computer is not in limbo forever.
61- $POWEROFF_QUIET || echo " $0 : Power-race avoidance: sleeping $POWEROFF_WAIT " >&2
64+ $POWEROFF_QUIET || {
65+ echo " $0 : Power-race avoidance: sleeping $POWEROFF_WAIT " >&2
66+ [ -w /dev/console ] && echo " ` TZ=UTC LANG=C date` : $0 : Power-race avoidance: sleeping $POWEROFF_WAIT " > /dev/console || true
67+ }
6268
6369 # The argument may be anything compatible with /bin/sleep
6470 # (on OSes with systemd - assuming GNU coreutils or compatible,
6571 # so not necessarily a non-negative integer)
6672 /bin/sleep $POWEROFF_WAIT
6773
68- $POWEROFF_QUIET || echo " $0 : Power-race avoidance: sleep finished, rebooting..." >&2
74+ $POWEROFF_QUIET || {
75+ echo " $0 : Power-race avoidance: sleep finished, rebooting..." >&2
76+ [ -w /dev/console ] && echo " ` TZ=UTC LANG=C date` : $0 : Power-race avoidance: sleep finished, rebooting..." > /dev/console || true
77+ }
6978
7079 # We need to pass --force twice here to bypass systemd
7180 # and execute the reboot directly ourself.
0 commit comments