On 2017-01-07 11:04, Michael Hirmke wrote:
Hi Carlos,
[...]
For example, send pending nntp messages before going into hibernation.
This is because there is a cron job that does it, but I might write a message and go into hibernation immediately, before the cron job runs. If I awake the machine a day later, the upstream server rejects the post because it is too old.
I tried to put things like that into the NetworkManager dispatcher scripts in /etc/NetworkManager/dispatcher.d, but even here sometimes it is too late, because NM stops the interfaces faster than my dispatcher scripts finished. And: It works only with NM versions > 1.2.2. At the moment in Leap 42.2 I use 1.4.4 from the Tumbleweed repo. You might be lucky, if the actions to be performed don't last too long.
It appears that the best option for me is to create a wrapper script that does the needed tasks, and when done, calls systemd to perform the hibernation, or aborts with a message if not possible. Some things could go to the systemd directory. I'm used to always call hibernation from the command "pm-hibernation", and never from the menu, so calling a script instead is no big issue. Why don't I use the menu? Because it does not work in xfce. Two issues: in one mode, it first blanks the screen, then it asks the root password to perform the action, which of course I never see and it never hibernates. The other failure mode is that it refuses to hibernate if thinks there is a root console open. There are old bugzillas for these. So I ended by using pm-hibernate as root or via sudo. -- Cheers / Saludos, Carlos E. R. (from 42.2 x86_64 "Malachite" at Telcontar)