[Pm-utils] stopping custom services
Stefan Seyfried
seife at suse.de
Fri Mar 9 07:58:22 PST 2007
On Tue, Mar 06, 2007 at 09:30:26PM +0100, Kibanadai wrote:
> Hello guys,
> I have some questions and associated concepts which I would request you to
> explain/answere.
> (1) Let me start with a question.
>
> I am using suse 10.2 with pmutils. What I would like to do is following. I
> would like to be able to define some services in /etc/pm/config which will be
> stopped before suspending the computer and restarted after resuming (as one
> can define modules). How do I do this?
You write a custom hook that does restart your services. How to write such
a hook is described for example on http://en.opensuse.org/Pm-utils
I would write one hook per service, and then you can easily enable / disable
them by setting their executable bit.
> (2) Here is what I understand. One can define custom hook which would utilize
> startservice and restartservice functions defined in /etc/pm/function.
> However, I want to be able to define a global configuration variable (like
> SUSPEND_MODULES) say SUSPEND_SERVICES. At present, I see that the easiest way
> to do is add this variable in /etc/pm/functions and also in /etc/pm/config.
> Is this is the only way?
>
> (3) From documentation, I understand (not fully though) that config.d
> directory is provided so that one can put their custom configuration file
> there. How do I use this functionality if I don't want to touch the
> default /etc/pm/config file at all to define my custom variables? Could some
> one elaborate a bit what exactly source_config function in /etc/pm/function
> does to the files present in config.d directory?
I think, but have not tried it, that you can put your config file "myconfig"
into /etc/pm/config.d, make it executable and just put
SUSPEND_SERVICES="foo bar baz"
into it. Then in your hook /etc/pm/hooks/42myhook you should be able to
use $SUSPEND_SERVICES.
If that does not work, it would be a bug, IIUC.
--
Stefan Seyfried
"Any ideas, John?"
"Well, surrounding them's out."
More information about the Pm-utils
mailing list