[systemd-devel] question about system reboot and shutdown
Marek FloriaĆczyk
marek.florianczyk at gmail.com
Tue Aug 8 14:03:07 UTC 2017
Hi all,
I have a small device MicroUPS which helps me to shutdown my system on
embedded devices, it is controlled by script /etc/init.d/microups and in this
script I need to know whether system is going down for reboot or for halt,
because in case of halt I need to send small data over RS232 to MicroUPS
device to cut the power off.
In previous version of init system I checked $runlevel variable but now I'm
doing some "grep" commands according to this post
https://stackoverflow.com/questions/25166085/how-can-a-systemd-controlled-service-distinguish-between-shutdown-and-reboot
and sometimes my method doesn't work. Either in /usr/bin/systemctl list-jobs
there is sometimes reboot and shutdown process present, or my microupsd
process gets killed before it sends data to the MicroUPS device over Rs232.
What would be the proper way to distinguish between system is going down for
reboot and for shutdown ?
Best Regards
Marek
More information about the systemd-devel
mailing list