You are not logged in.
Maybe I just didn't see something I need to do...
I have this script:
-rwxr-xr-x 1 root root 322 13. Nov 10:13 /usr/lib/systemd/system-sleep/resume.sh*
And whether I suspend with the kde suspend thingy or with systemctl suspend, this script does not run on resume from suspend.
The script looks like this:
#!/bin/bash
case $1/$2 in
pre/*)
exit 0
;;
*)
#
# some lines to put graphics card back to sleep with vgaswitcheroo
#
;;
esacDid i do something wrong or do I need to do something else?
Last edited by Cdh (2012-11-19 00:58:54)
฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz
Offline
Hello,
This is from the arch wiki:
---
An example of a custom sleep script:
/usr/lib/systemd/system-sleep/example.sh
#!/bin/sh
case $1/$2 in
pre/*)
echo "Going to $2..."
;;
post/*)
echo "Waking up from $2..."
;;
esacI think you just forgot the post/* , that's the part when it comes back from sleep
Don't do this -> /bin/bash shred -fun 42 `ls`
--------------------------------------
.:Blog:.:github:.:Livejournal:.:Pastebin:.
Offline
Nope, I have tested it, *) catches "post suspend" when I run
sudo /usr/lib/systemd/system-sleep/resume.sh post suspendMy problem is basically that I don't know how to find out why it doesn't run without reading all the code. The documentation basically only says "put your script there and systemd will run it". If it doesn't, what then? It's quite an old systemd installation so maybe some service file dependency is not set because it only came later. But I don't know how about finding out such stuff...
฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz
Offline
If you have systemd installed as I'd expect, you'll have the following file:
#/usr/lib/systemd/system/suspend.target
[Unit]
Desciption=Suspend
Documentation=man:systemd.special(7)
DefaultDependecies=no
BindsTo=systemd-suspend.service
After=systemd-suspend.serviceHowever you can also make a file with the same name in /usr/lib/systemd/ in which case it takes precedance. But I assume you didn't mess around with that. The thing is it has no special dependencies. So the script should run.
Try to check the log messages of the output of your scripts
journalctl -u systemd-suspendThat should show more light on what is going on. If you did it yourself already then let us see the output.
Last edited by ytech (2012-11-18 20:04:06)
Don't do this -> /bin/bash shred -fun 42 `ls`
--------------------------------------
.:Blog:.:github:.:Livejournal:.:Pastebin:.
Offline
I did some further testing with my system, it appears that using the '*)' specifically causes a "Job for suspend.target canceled" on resume, which could be the problem you are facing. It could also be that the syntax for the pre and post are explicitly given, otherwise I don't see a reason why would it print that message.
Given the code:
#!/bin/sh
#can also be /bin/bash
case $1/$2 in
*)
echo "a $1 with $2"
;;
esacWorks and does not produce the above (red) message.
However combining "pre/*)" and "*)" generates the message, regardless of the shell.
I was doing all the suspends with systemctl suspend
So I'd suggest putting a lot of echo statements in your script and then observe the output of journalctl -b -u systemd-suspend (this is where the echo statements get logged) and check for any errors it might throw. And try to use the pre/*) post/*) if you didn't try that yet.
EDIT:
Forgot to mention I was doing all this as root
Last edited by ytech (2012-11-18 20:46:34)
Don't do this -> /bin/bash shred -fun 42 `ls`
--------------------------------------
.:Blog:.:github:.:Livejournal:.:Pastebin:.
Offline
The journal was useless, stopped logging two days ago.
But after restarting systemd-journald.service I did learn that my script did indeed run but not the parts I expected it to run. Either it did not want to run a backgrounded sh script or it exited on the first subshell that didn't return 0. Either way it seems to have my mistake to assume that systemd didn't run my script and rather a service file behaviour I was not aware of.
฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz
Offline