I'm playing around with Container Optimized OS on Google Cloud and found that the 'Auto Update' feature doesn't apply the updates until the system is restarted, and doesn't offer any functionality for scheduling a reboot after an update is applied.
I'm writing a simple startup script that schedules a shutdown when a reboot is needed, essentially:
#!/usr/bin/env sh
update_engine_client --block_until_reboot_is_needed
shutdown -r 02:00
My question is: how do I determine whether a shutdown has been scheduled? I have tried three methods so far that don't work in this OS:
$ ps -ef | grep shutdown
- no shutdown process$ systemctl status systemd-shutdownd.service
-Unit systemd-shutdownd.service could not be found.
cat /run/systemd/shutdown/scheduled
- no file found
Documentation on this OS, and what it's based on, are slim. What determines how shutdown is scheduled, and how does COS handle it?
In Container-Optimized OS, the following command will display pending shutdown information in epoch time:
$ busctl get-property org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager ScheduledShutdown
I am curious why Google chose to use
busctl
instead ofsystemd
- I was unfamiliar withbusctl
and had to do some reading on it to understand what the command is doing -busctl
man pageExample: