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.



-- 
 
uname -rsvp
Linux 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
(yes, this is the output from uname for this PC when I posted)
 
Boilerplate:  All unexpected mail to my mailbox is automatically deleted.
I will only get to see the messages that are posted to the mailing list.
 

-- 
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
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@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to