You are not logged in.
I have some scripts that I want to run after coming out of suspend mode, so I've created some scripts in /lib/systemd/system-sleep, but they never run. Here's the inside of one of the scripts I stole from the internet:
/lib/systemd/system-sleep/debug:
#!/bin/sh
case $1/$2 in
pre/*)
echo "Going to $2..."
# Place your pre suspend commands here, or `exit 0` if no pre suspend action required
echo deez nutz > /home/sv-cheats-1/suspend
;;
post/*)
echo "Waking up from $2..."
echo nutz deez > /home/sv-cheats-1/suspend
# Place your post suspend (resume) commands here, or `exit 0` if no post suspend action required
;;
esac
Upon coming out of suspend there is no new text added to the text file via "echo", so I guess it doesn't work. Any ideas as to why and how to fix/debug this?
Last edited by sv-cheats-1 (2022-05-01 20:06:31)
Offline
stat /lib/systemd/system-sleep/debug
Offline
Offline
I don't know why, but the below script seems to work as intended, don't know why the first one didn't work.
#!/bin/bash
case $1 in
pre) case $2 in
hibernate)
echo "Going to suspend to disk!"
;;
hybrid-sleep)
echo "Going to suspend to disk and ram!"
;;
suspend)
echo "Suspending to RAM." >> /home/sv-cheats-1/test
/usr/bin/nmcli dev con enp5s0 >> /home/sv-cheats-1/test
/usr/bin/warp-cli connect >> /home/sv-cheats-1/test
;;
*)
echo "Unexpected case"
;;
esac ;;
post)
echo "We are now resuming from $2."
;;
*)
echo "Unexpected case"
;;
esac
Offline
Spoke too soon, doesn't work/works inconsistently
Offline
Here's the output of "journalctl -b -u systemd-suspend.service"
Apr 30 14:17:33 sv-cheats-1 systemd-sleep[2758]: System returned from sleep state.
Apr 30 14:17:33 sv-cheats-1 systemd-sleep[2801]: Error: Failed to add/activate new connection: Connection 'enp5s0' is not available on device enp5s0 because device is strictly unmanaged
Apr 30 14:17:33 sv-cheats-1 [2792]: /usr/lib/systemd/system-sleep/enableWarp failed with exit status 4.
Apr 30 14:17:33 sv-cheats-1 systemd[1]: systemd-suspend.service: Deactivated successfully.
Apr 30 14:17:33 sv-cheats-1 systemd[1]: Finished System Suspend.
Last edited by sv-cheats-1 (2022-05-01 08:19:35)
Offline
stat /lib/systemd/system-sleep/debug
Renamed script to network sorry
stat /lib/systemd/system-sleep/network
File: /lib/systemd/system-sleep/network
Size: 591 Blocks: 8 IO Block: 4096 regular file
Device: 259,6 Inode: 2892860 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2022-05-01 11:06:14.678797150 +0300
Modify: 2022-05-01 11:06:13.052119330 +0300
Change: 2022-05-01 11:06:13.068786112 +0300
Birth: 2022-05-01 11:06:13.052119330 +0300
Last edited by sv-cheats-1 (2022-05-01 10:46:34)
Offline
Apr 30 14:17:33 sv-cheats-1 systemd-sleep[2801]: Error: Failed to add/activate new connection: Connection 'enp5s0' is not available on device enp5s0 because device is strictly unmanaged
Doesn't suggest that the script doesn't run - just that it fails?
/lib/systemd/system-sleep/debug:
#!/bin/bash
case $1/$2 in
pre/*)
echo "Going to $2..."
# Place your pre suspend commands here, or `exit 0` if no pre suspend action required
date >> /home/sv-cheats-1/suspend
echo "deez nutz" >> /home/sv-cheats-1/suspend
;;
post/*)
echo "Waking up from $2..."
date >> /home/sv-cheats-1/suspend
echo "nutz deez" >> /home/sv-cheats-1/suspend
# Place your post suspend (resume) commands here, or `exit 0` if no post suspend action required
;;
esac
Offline
Apr 30 14:17:33 sv-cheats-1 systemd-sleep[2801]: Error: Failed to add/activate new connection: Connection 'enp5s0' is not available on device enp5s0 because device is strictly unmanaged
Doesn't suggest that the script doesn't run - just that it fails?
/lib/systemd/system-sleep/debug: #!/bin/bash case $1/$2 in pre/*) echo "Going to $2..." # Place your pre suspend commands here, or `exit 0` if no pre suspend action required date >> /home/sv-cheats-1/suspend echo "deez nutz" >> /home/sv-cheats-1/suspend ;; post/*) echo "Waking up from $2..." date >> /home/sv-cheats-1/suspend echo "nutz deez" >> /home/sv-cheats-1/suspend # Place your post suspend (resume) commands here, or `exit 0` if no post suspend action required ;; esac
Looks like it, seems like nmcli can't manage the device for some reason?
Offline
I guess that's because of the S3 - what are you trying to do there itfp? Why are you trying to manipulate the network while entering the sleep?
Offline
I guess that's because of the S3 - what are you trying to do there itfp? Why are you trying to manipulate the network while entering the sleep?
I've setup warp vpn on my system and I've noticed that if I suspend the system the VPN disconnects. I had looked up and found a way to run script after coming out of suspend so I've setup that script. It worked for a while until one day it stopped working for some reason and would break the entire connection. I decided to add the
nmcli dev con enp5s0
to mediate that.
Offline
Jesus, I've made the script run in the wrong time omg gimme a second
Offline
Ok, so I've changed things so that they are where they should be:
#!/bin/bash
case $1 in
pre) case $2 in
hibernate)
echo "Going to suspend to disk!"
;;
hybrid-sleep)
echo "Going to suspend to disk and ram!"
;;
suspend)
echo "Suspending to RAM."
;;
*)
echo "Unexpected case"
;;
esac ;;
post)
echo "We are now resuming from $2."
/usr/bin/nmcli dev con enp5s0 >> /home/sv-cheats-1/test
/usr/bin/warp-cli connect >> /home/sv-cheats-1/test
;;
*)
echo "Unexpected case"
;;
esac
Here's the output of "journalctl -b -u systemd-suspend.service"
May 01 22:38:24 sv-cheats-1 systemd-sleep[17371]: System returned from sleep state.
May 01 22:38:24 sv-cheats-1 systemd-sleep[17484]: We are now resuming from suspend.
May 01 22:38:24 sv-cheats-1 systemd-sleep[17491]: Error: Failed to add/activate new connection: Connection 'enp5s0' is not available on device enp5s0 because device is strictly unmanaged
May 01 22:38:24 sv-cheats-1 systemd[1]: systemd-suspend.service: Deactivated successfully.
May 01 22:38:24 sv-cheats-1 systemd[1]: Finished System Suspend.
The connection is still broken, still need to do things manually after resume.
Offline
This is probably running too early, https://wiki.archlinux.org/title/Networ … dispatcher ?
Offline
This is probably running too early, https://wiki.archlinux.org/title/Networ … dispatcher ?
Oh yeah, now we're rolling! Thank you very much seth! It works! You are ny hero!
Offline