I would like to automatically close down VMs which have been inactive for (say) 15 minutes. By inactive I mean there has been no user keyboard or mouse input to the VM. Does VBoxManage provide a way of detecting such inactivity?
An alternative would be some script in the guest which could be used to detect inactivity and send a message to the host to trigger a shutdown. The screensaver is obviously monitoring inactivity but it doesn't seem to log its actions.
VirtualBox 7.0.6
Host: CentOS 7
Guest: Linux Mint 20
Close inactive VMs
-
- Site Moderator
- Posts: 20945
- Joined: 30. Dec 2009, 20:14
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Windows, Linux
Re: Close inactive VMs
I don't believe that there are any Virtualbox commands to catch such inactivity.
You can use "vboxmanage guestproperty get/set" to communicate text data between the host and VM when Guest Additions are installed in the VM.
Set a guestproperty with vboxmanage guestproperty set" on the host, then loop in the script with "vboxmanage guestproperty get" waiting for the guestproperty to reset. The script in the VM can call "vboxcontrol guestproperty set" to reset the guestproperty when the programmed inactivity occurs. Then the host script sees the reset guestproperty and shuts down the VM.
You can use "vboxmanage guestproperty get/set" to communicate text data between the host and VM when Guest Additions are installed in the VM.
Set a guestproperty with vboxmanage guestproperty set" on the host, then loop in the script with "vboxmanage guestproperty get" waiting for the guestproperty to reset. The script in the VM can call "vboxcontrol guestproperty set" to reset the guestproperty when the programmed inactivity occurs. Then the host script sees the reset guestproperty and shuts down the VM.