Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have found that printing to shared printers through CUPS fails after a suspend to RAM (on the client). Some probing revealed that if I restart the avahi-daemon, then printing works properly.
Is there some way to automatically restart this daemon when the system is resuming so it doesn't need to be done manually each time?
From the Debian hibernate-.*/README: "The Debian version of the suspend script installs the standard scriptlets in /usr/share/hibernate/scriptlets.d, but also looks in /etc/hibernate/scriptlets.d and /usr/local/share/hibernate/scriptlets.d for any custom scriptlets that you may want to write. Documentation on writing scriptlets can be found in /usr/share/doc/hibernate/SCRIPTLET-API.gz". So it's possible to write a hook for this.
I can't discern any relationship between the hibernate utility, which makes use of /usr/share/hibernate, and the s2ram program that I'm actually using, whose documentation never mentions anything like that. The hibernate utility doesn't seem to have suspend to ram as an option, just suspend to disk---not what I want.
So does anybody know how to run something automatically when returning from s2ram?
As far as I can tell, s2ram is the low level program that causes the hardware to suspend. There is no mention anywhere that I can see of scripting hooks, or I wouldn't have posted here. It sounds like the recovery is done by the kernel itself, from what I can decipher in the documentation (which talks about how you have to recompile your kernel with the right patches, etc, etc).
There is no mention anywhere that I can see of scripting hooks
S2ram doesn't work on its own. Looking at some HOWTO's should show its just one in a group of apps one would install to have suspend functionality. Regardless of that the generic principle remains AFAIK: once the system awaks stuff gets run, so about anything that has hooks for running arbitrary scripts or that runs periodically could do.
S2ram doesn't work on its own. Looking at some HOWTO's should show its just one in a group of apps one would install to have suspend functionality. Regardless of that the generic principle remains AFAIK: once the system awaks stuff gets run, so about anything that has hooks for running arbitrary scripts or that runs periodically could do.
I'm not sure what you mean that s2ram doesn't work on its own. It works with the kernel, of course. But so what?
Here's a description of s2ram:
s2ram is a wrapper around the kernel's suspend-to-RAM mechanism allowing the user to perform some graphics adapter manipulations from the user land before suspending and after resuming
I suppose I could replace s2ram with a script that calls the original s2ram and then does stuff afterwords. For some reason this approach didn't occur to me. (The script would probably have to be suid root.)
Somehow it doesn't seem reasonable to restart a daemon periodically...what, every 10 seconds I restart it?
So pm-utils does indeed provide a suspend mechanism with hooks. And I set it up to restart the daemon, which seems to work as desired. Except that pm-suspend has to be run as root, so I still need a suid program to kick it off.
I thought perl could do suid scripts, but it gave me an error about being unable to run sperl, so I just wrote a C program instead. But something still goes wrong. Even though the pm-utils manual says that hooks run as root, when my hook runs the uid is 1000 and the daemon restart fails. (If I run pm-suspend as root then all works as planned and the daemon restarts.)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.