Created
September 14, 2020 16:07
-
-
Save SamMousa/8d4a538f088dd24c9180c6929203a005 to your computer and use it in GitHub Desktop.
Virtualbox on ZFS in SystemD, proper shutdown and process management
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspired by https://blogging.dragon.org.uk/start-stop-virtualbox-with-systemd/ | |
[Unit] | |
Description=Virtual Box Guest %I | |
After=network.target virtualbox.service zfs-volume-wait.service | |
Before=runlevel2.target shutdown.target | |
[Service] | |
User=root | |
Group=root | |
Type=simple | |
RemainAfterExit=no | |
ExecStart=/usr/bin/VBoxHeadless -s %i | |
ExecStop=-/usr/bin/VBoxManage controlvm %i acpipowerbutton | |
ExecStop=/usr/bin/bash -c 'until VBoxManage showvminfo DirectResearch | grep -E "^State:" | grep -v running; do sleep 1; done' | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment