Update:
Seems like a recent Dom0 update might’ve removed the modifications I made to /usr/lib64/pm-utils/sleep.d/52qubes-pause-vms
I tried to append/prepend my script to /usr/lib/systemd/system/qubes-suspend.service
’s ExecStart=
line but couldn’t get it to trigger my script.
Ultimately, I moved my shutdown on sleep script to /usr/local/bin/
and inserted it where I had inserted my commands in /usr/lib64/pm-utils/sleep.d/52qubes-pause-vms
. The main difference being that the next time this file gets overwritten, I won’t lose my entire script.
I started a little script to re-insert my script into /usr/lib64/pm-utils/sleep.d/52qubes-pause-vms
, but I’m not sure the best way to hook it. Open to ideas.
Here’s the script I wrote to re-add my script:
### Variables
myscript="/usr/local/bin/<my script>"
target="/usr/lib64/pm-utils/sleep.d/52qubes-pause-vms"
### Check to see if the script is in place; add it if not, peace out if so
if ! grep -q "$myscript" "$target"; then
# If the search string is not found, insert the new string
sed -i "/hibernate)/a\ $myscript" $target
fi