I wrote a script that suspend all my virtualbox machines, and put a line in
/etc/rc.local.shutdown, but it doesn't seem to work,
su - XX -c /XX
When I'm booted next time, virtualbox tells me the machine was
Aborted, so the script wasn't executed. (Launching that script manually works for me)
P.S I already enabled
The problem seems complicated than I thought, in my bashrc, if it's running on tty3, it executes
startx, so when systemd decide to shutdown/reboot, it whould kill VBoxSVC process and other stuff when X session dies.
I also tried to hack the source code of
xfsm-shutdown-helper, make a fake
systemctl that execute my script first, none of the above works.