Page 1 of 1
Save Machine State
Posted: 17. Mar 2011, 07:49
by joako
Is there some simple way? What I want to do is setup MacOS autologin, run VM on login. When logging out, rebooting, quit virtualbox, etc I would like the options "Save Machine State" to be taken automatically, so imagine,
1) Turn on Mac, Logs in to account & starts up VM automatically
2) Log out or shut down mac, VM "save machine state" without any further prompt or problem.
Re: Save Machine State
Posted: 19. Mar 2011, 13:07
by Sasquatch
To get the save state when the user logs out (this happens too when you reboot or shut down), you have to find some hacks to run a script before the actual log off procedure starts. That way, VM is properly put into a saved state before anything starts to be closed by the log off procedure, as that can kill -9 a process if it takes too long to close.
I've also removed your cross-post. It's not allowed here. It was also posted in an old topic.
Re: Save Machine State
Posted: 14. Mar 2012, 11:19
by abhibeckert
I'd also like to have this ability.
What are you talking about with kill -9? Perhaps on other operating systems that is the case. On OS X no GUI app will never be killed by the system. Never. Only a user can kill an app, either by typing `kill -9` at a bash prompt, or with the "Force Quit" feature.
When a user logs off, it sends an event to all processes instructing it to save state and quit. After a couple seconds, if any GUI apps are still running then the log out/shut down/etc is aborted altogether and the user is instructed to close that app and try again.
The end result is, every single time I log out or reboot my mac, it fails with an "VirtualBox Canceled Log Out" alert message, I have to then go press return in virtual box, wait 30 seconds, and then repeat the log out/reboot command. It's standard practice for every OS X app to save it's state when instructed to quit, that's what all my other apps do automatically and it's annoying to have to go press an OK button every time.