In order to easier switch between different operating systems on a pc, one can suspend to disk and configure grub to automatically reboot after suspending.
The command s2disk
has options to easily trigger a reboot after suspending. This command is part of the uswsusp
package on debian systems.
apt-get install uswsusp
An example script to suspend to disk and reboot immediately is:
#!/bin/sh sudo grub-set-default 2 # here '2' is whichever option is Windows sudo s2disk -P 'shutdown method = reboot'
The file /etc/default/grub
contains the main configuration and the default entry for the linux system - usually 0. This will then ensure that after rebooting from windows, the linux system will be loaded again.