-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Interesting that you need something like this - very similar thing is
already included there (see below). Check logs about qubes-suspend
service - maybe it doesn't work on your system for some reason?
- ---------
[marmarek@dom0 ~]$ cat /usr/lib/systemd/system/qubes-suspend.service
[Unit]
Description=Qubes suspend hooks
Before=sleep.target
StopWhenUnneeded=yes
[Service]
Type=oneshot
RemainAfterExit=yes
StandardOutput=syslog
ExecStartPre=/usr/lib64/pm-utils/sleep.d/01qubes-sync-vms-clock suspend suspend
ExecStartPre=/usr/lib64/pm-utils/sleep.d/51qubes-suspend-netvm suspend suspend
ExecStart=/usr/lib64/pm-utils/sleep.d/52qubes-pause-vms suspend suspend
ExecStop=/usr/lib64/pm-utils/sleep.d/52qubes-pause-vms resume suspend
ExecStopPost=/usr/lib64/pm-utils/sleep.d/51qubes-suspend-netvm resume suspend
ExecStopPost=/usr/lib64/pm-utils/sleep.d/01qubes-sync-vms-clock resume suspend
[Install]
WantedBy=sleep.target
[marmarek@dom0 ~]$ cat /usr/lib64/pm-utils/sleep.d/52qubes-pause-vms
#!/usr/bin/python
from qubes.qubes import QubesVmCollection,QubesException
import sys
qc = QubesVmCollection()
qc.lock_db_for_reading()
qc.load()
qc.unlock_db()
if sys.argv[1] in ["suspend", "hibernate"]:
for vm in qc.values():
if vm.is_running():
try:
vm.run_service("qubes.SuspendPreAll", user="root")
vm.suspend()
except Exception as e:
print >>sys.stderr, "Failed to suspend VM %s: %s" % (
vm.name, e.message)
elif sys.argv[1] in ["resume", "thaw"]:
for vm in qc.values():
if vm.get_power_state() in ["Paused", "Suspended"]:
try:
vm.resume()
vm.run_service("qubes.SuspendPostAll", user="root")
except Exception as e:
print >>sys.stderr, "Failed to resume VM %s: %s" % (
vm.name, e.message)
- --
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQEcBAEBCAAGBQJY8PzdAAoJENuP0xzK19csgysIAJn6OXoblws4QJzUguJ8yp7c
rP5E8YgUUl6PxJIB9cHRuB1xuGQ4XQ+X/xJYBRYSGagJ6tus293WRgxlVIxSD+rV
w+ezfqqO2dIz6xQE0EpcwIkP+uMx9eIIuhPKoe4sa+CSC4nbj9+dF+yjPL+Qxprp
oOyXe3p+ascedvYlVrnK/vKT/zPSm2eYSdBivDyC6OxhIRnI0BvxQHYMBn5siG/H
WQOnwvrGGgJ+bL4+0/NcnmQOmBb0X0RLzrETSjELukKeKH5RVCMvx1tTACDmPXT2
OLwBpc1xsPoyr8XxJqSBGo+4BcgKceOWWjz8tlXrR+Sk+FVZJfMqVsgB/6TpKmU=
=k+M6
-----END PGP SIGNATURE-----