Re: Running script after resuming suspend

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

 



On Mon, 25 Aug 2025 12:50:13 +0930
Tim via users <users@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

> On Sun, 2025-08-24 at 08:04 -0700, Geoffrey Leach wrote:
> > I need to restart a process after suspend
> > 
> > As root, I created an executable script in
> > /usr/lib/systemd/system-sleep:  
> 
> I would have thought somewhere in /etc/systemd/ for user-created
> things.
> 
> > case "$1/$2" in
> >       pre/*)
> >       ;;
> >       post/*)
> >          echo 'foo'
> >       ;;
> > esac
> > 
> > On suspend/resume
> > journalctl -u test.sh
> > -- No entries   
> 
> SELinux contexts, perhaps?
> 
> If you created the file, or copied it, to a standard system place for
> such scripts, it ought to have the right contexts.
> 
> But if you moved it, it won't.  It'll have the default contexts for
> wherever you originally created the file.
> 
> I've only done something **vaguely** similar.  Whenever a network
> comes up, named (bind) is restarted.
> 
> /etc/NetworkManager/dispatcher.d/20-named
> 
> 
> #!/bin/sh
> 
> ## /etc/NeworkManager/dispatcher.d/20-named
> ## added by me 19 Jan 2025
> ##
> ## Idea copied from 20-squid, to restart a service if a network goes
> up, if ## that service was already running.  But do nothing if that
> service was ## stopped.
> ##
> ## Using mobile phone for computer's internet access, lately, and
> ## pop.mail.yahoo.com.au DNS records were expiring when off-line.
> Then, ## when going back on-line, fetchmail would fail to get mail
> from yahoo, ## needing named to be manually reloaded to refresh its
> DNS records.
> 
> case "$2" in
>         up)
>                 if [ -f /var/run/named/named.pid ]; then
>                         /bin/systemctl reload named.service || :
>                 fi
>                 ;;
> esac
> 
> One other thing I could think of, about a script not running after
> resuming from suspend, is it being run sufficiently after things have
> resumed?
> 
> You could try triggering your script from some other event, as a test,
> so you don't have to go suspending and resuming over and over.
> 
No SELinux here :-)
-- 
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux