[systemd-devel] Script in system-sleep that makes an HTTP post

Tomasz Torcz tomek at pipebreaker.pl
Fri Jun 11 15:40:50 UTC 2021


Dnia Fri, Jun 11, 2021 at 10:50:34AM -0400, Doug Koobs napisał(a):
> 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?
>     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?

  Looking at match_prepare_for_sleep() function in systemd-networkd, it
doesn't seem to do anything. So systemd do not touch network when
sleeping.
  But if you use NetworkManager, it has quite comprehensive handling of
the sleep signal. You may want to look at NM configuration to see what
can be done.
  If you're using another network management software, the story can be
similar to NM. Anyway, systemd does not touch network when suspending.


-- 
Tomasz Torcz               There exists no separation between gods and men:
tomek at pipebreaker.pl       one blends softly casual into the other.  — Frank Herbert



More information about the systemd-devel mailing list