core-admin/dom0/pm-utils/01qubes-sync-vms-clock
Marek Marczykowski e7b65b457b dom0/pm-utils: initial clock sync also in ClockVM after resume
When there is no internet connection, clockvm will have no chance to sync clock
itself.
2012-03-09 20:16:55 +01:00

25 lines
557 B
Bash
Executable File

#!/bin/sh
. "${PM_FUNCTIONS}"
sync_qubes_vms_wallclock()
{
# Sync all VMs based on dom0 clock
DATE=$(date)
echo
echo "Syncing VMs clock to: $DATE"
qvm-run --all -u root "date -s \"$DATE\""
# Then try to sync from the network
/usr/bin/qvm-sync-clock &
}
case "$1" in
thaw|resume) sync_qubes_vms_wallclock ;;
# Kill qvm-sync-clock (if running) to not desync time after resume
suspend|hibernate)
killall qvm-sync-clock 2> /dev/null
exit 0
;;
*) exit 0 ;;
esac