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
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 ?
systemd-devel mailing list