When I'm initiating "reboot" or "poweroff", systemd is killing all the processes, but I need it to wait for one particular application to finish before stopping other services.
Actually, I want Virtualbox vm clean shutdown/savestate. Have no problem of doing it manually with this service file, but during the shutdown - processes are killed. How can I control it?
I've read docs, but didn't find clear solution for this kind of dependency.
[Unit]
Description=virtualbox vm1 vm control service
After=vboxweb-service.service
Before=shutdown.target
[Service]
Type=oneshot
ExecStart=/usr/bin/VBoxManage startvm vm1 -type vrdp
ExecStop=/usr/bin/VBoxManage controlvm vm1 savestate
RemainAfterExit=true
Solved.