I'm using Ubuntu in VMware 8 in a public lab and sometimes the computer may be restarted or shut down accidentally. Is there any way to prevent ubuntu from shutting down in order to continue running the program from where it has been stopped?
If the host operating system shuts down uncontrolled (you say accidentally) be it by an unwanted manual shut down, after an application crash, or worst a power failure, there is no way any guest operating system (not even Ubuntu) can detect and react on such an incident. All data from the guest OS will be lost.
To prevent this we need to at least save the guest session prior to shut down of the host. Depending on the host OS it may be done automatically by including this into the shutdown routine (which of course needs time to finish before the host machine was powered off).