[Top][All Lists]

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

Re: /etc/inittab, editfiles and kill -HUP 1

From: John Valdes
Subject: Re: /etc/inittab, editfiles and kill -HUP 1
Date: Sun, 20 May 2001 23:26:51 -0500
User-agent: Mutt/1.2.5i

On Sat, May 19, 2001 at 08:27:17AM -0700, Matt Armstrong wrote:
> Is there a way for the execution of a given 'editfiles' command to
> also run a shell script?

Yes.  Create a shellcommand command which runs only if a certain class
is defined, and then use the DefineClasses action to define the class
in the editfiles command.  The DefineClasses action will define the
class if and only if the file for which this action is specified is

> E.g. I have an AppendIfNoSuchLine that adds a service to /etc/inittab.
> If the line is appended, I'd like to run 'kill -HUP 1'.

Actually, for /etc/inittab systems, you may need to run 'telinit q'
(rather than 'kill -HUP 1') to tell init to reread /etc/inittab, but
in any case, you'd want to use something like:


    actionsequence =


    { /etc/inittab
      AppendIfNoSuchLine "sc:3:once:/some/command"
      DefineClasses "telinit"


      "/etc/telinit q"

> But I don't want to 'kill -HUP 1' unecessarily.

In the example above, if /etc/inittab doesn't contain the indicated
line, cfengine will add it, and then define the "telinit" class.
Then, when cfengine processes the shellcommands section (which it will
do after editfiles, given the order specified in the control section),
it will see that the telinit class is defined, and hence run
"/etc/telinit q".  On the other hand, if /etc/inittab already
contains the indicated line, cfengine won't define the telinit class,
and hence /etc/telinit won't be run when shellcommands is processed.
That way, telinit won't be run unnecessarily, as you want.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]