- User ID
- 1
- Joined
- 7 Jan 2019
- Messages
- 943
- Reaction score
- 40
- Points
- 28
It is a short entry, but a useful one, as it is important to have a basic knowledge of how to schedule a system reboot or power it down automatically at the specified time.
Schedule operation
Reboot system now.
Shutdown system now.
Reboot system at 14:30.
Shutdown system after 80 minutes.
Cancel a pending operation.
Verify pending operation on Debian Jessie (systemd 215).
Verify operation
Verify pending operation on Ubuntu Wily Werewolf using D-Bus.
This operation can be divided into two steps:
Please verify that you can rely on /run/systemd/shutdown/scheduled file as it is not deleted after the whole operation is aborted using Ubuntu 15.10 and systemd 225.
Schedule operation
Reboot system now.
Bash:
$ sudo shutdown -r now
Shutdown system now.
Bash:
$ sudo shutdown -P now
Reboot system at 14:30.
Bash:
$ sudo shutdown -r 14:30
Shutdown system after 80 minutes.
Bash:
$ shutdown -P +80
Cancel a pending operation.
Bash:
$ shutdown -c
Verify pending operation on Debian Jessie (systemd 215).
Bash:
$ cat /run/systemd/shutdown/scheduled
Code:
USEC=1445770800000000
WARN_WALL=1
MODE=poweroff
Verify operation
Verify pending operation on Ubuntu Wily Werewolf using D-Bus.
Bash:
$ qdbus --literal --system org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.DBus.Properties.Get org.freedesktop.login1.Manager ScheduledShutdown
Code:
[Variant: [Argument: (st) "poweroff", 1445770800000000]]
Use date and bc command to pretty-print the scheduled date.Note that this timestamp is in microseconds (1/1000000 second).
Bash:
$ date -d @$(echo "(1445770800000000/1000000)" | bc)
Sun Oct 25 12:00:00 CET 2015
This operation can be divided into two steps:
Bash:
$ echo "(1445770800000000/1000000)" | bc
1445770800
Bash:
$ date -d @1445770800
Sun Oct 25 12:00:00 CET 2015
Please verify that you can rely on /run/systemd/shutdown/scheduled file as it is not deleted after the whole operation is aborted using Ubuntu 15.10 and systemd 225.