Script in system-sleep that makes an HTTP post

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,

tldr: Is there way I can use systemd to run scripts in /usr/lib/systemd/system-sleep at suspend before disabling the network?

I've put a script in /usr/lib/systemd/system-sleep that makes an HTTP post to an IFTTT webhook when it's passed "pre" as $1. The script is successful if I run it manually, but when systemd runs it when I suspend the laptop, running "journalctl -b -u systemd-suspend.service" reports:

    /usr/lib/systemd/system-sleep/outlet.sh failed with exit status 6.

perror defines exit status 6 as: OS error code   6:  No such device or address

This sounds like a network problem. If I disable networking and manually run the script, I get:

    curl: (6) Could not resolve host: maker.ifttt.com

My assumption is that systemd disables networking before the system-sleep scripts are run. Is there way I can use systemd to run the script before disabling the network?

Thanks!

Doug

_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux