I have a dual boot setup of Ubuntu and Windows with shared partitions. What I want to do is be able to hibernate them and then just wake them up individually. Now, this is simple enough. However, according to this answer, I need to be sure to unmount all shared partitions to avoid data loss. What I want to do is, whenever I trigger a hibernate, I want to automatically unmount the relevant drives. Adding a script within /usr/lib/systemd/system-sleep works well enough, but there is the very relevant case of the umount script failing due to the partition being in use (i.e. the music player I tend to keep up 90% of the time).
What I want to do is, when the umount operation fails, to cancel the hibernate operation, giving me the chance to close down the offending applications before trying again.
So far, I've tried the following:
- Failing the script. Exiting with an error code does not seem to faze the hibernate process, and it just logs the error and continues on.
- Looping with a dialog until the error is resolved. Unfortunately, the monitor shuts off no matter what, which means my machine gets stuck until I forcibly shut it down.
I get the feeling that the system-sleep scripts are not the solution. Is there an alternative that I can use?