help-cfengine
[Top][All Lists]
Advanced

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

Re: Order of Operations and Defining 2nd Run


From: christian pearce
Subject: Re: Order of Operations and Defining 2nd Run
Date: Thu, 23 Feb 2006 10:13:00 -0500

I don't think he wanted to change his actionsequence.  And even if you
have a classes defined in the actionsequence for a give action it
still runs all the statements for the action.  So in effect you get
the following.

actionsequence = ( processes shellcommands processes.post )

Watch:

control:

    actionsequence = ( processes.pre shellcommands processes.post )

processes:

    pre::

        "cron"
            signal=HUP
            define=class1

    any::
        "cron"
            signal=HUP
            define=class2

    post::
        "cron"
            signal=HUP
            define=class3

shellcommands:

    class1::
        "/bin/echo class1"

    class2::
        "/bin/echo class2"

    class3::
        "/bin/echo class3"

See it executed the processes class under any::, which is what Brian
was hoping to avoid.

*********************************************************************
 Main Tree Sched: processes.pre pass 1 @ Thu Feb 23 10:10:30 2006
*********************************************************************


                  New temporary class additions
                  --------( Pass 1 )-------
                             pre
cfengine:hsysnav02: Running process command /bin/ps auxw
cfengine:hsysnav02: Signalled process 2145 (cron) with SIGHUP
Defining classes class1
DoSignals(cron)
cfengine:hsysnav02: Signalled process 2145 (cron) with SIGHUP
Defining classes class2
DoSignals(cron)

*********************************************************************
 Main Tree Sched: shellcommands pass 1 @ Thu Feb 23 10:10:30 2006
*********************************************************************

cfengine:hsysnav02: Executing script /bin/echo
class1...(timeout=0,uid=-1,gid=-1)
(Setting umask to 77)
cfengine:hsysnav02:/bin/echo class: class1
cfengine:hsysnav02: Finished script /bin/echo class1
cfengine:hsysnav02: Executing script /bin/echo
class2...(timeout=0,uid=-1,gid=-1)
(Setting umask to 77)
cfengine:hsysnav02:/bin/echo class: class2
cfengine:hsysnav02: Finished script /bin/echo class2

*********************************************************************
 Main Tree Sched: processes.post pass 1 @ Thu Feb 23 10:10:30 2006
*********************************************************************


                  New temporary class additions
                  --------( Pass 1 )-------
                             post
cfengine:hsysnav02: Running process command /bin/ps auxw
cfengine:hsysnav02: Signalled process 2145 (cron) with SIGHUP
Defining classes class3
DoSignals(cron)
Checking for potential rule:: Shell </bin/echo class3> / class3

*********************************************************************
 Main Tree Sched: processes.pre pass 2 @ Thu Feb 23 10:10:30 2006
*********************************************************************


                  New temporary class additions
                  --------( Pass 2 )-------
                             pre
cfengine:hsysnav02: Running process command /bin/ps auxw
Checking for potential rule:: Shell </bin/echo class3> / class3

*********************************************************************
 Main Tree Sched: shellcommands pass 2 @ Thu Feb 23 10:10:30 2006
*********************************************************************

cfengine:hsysnav02: Executing script /bin/echo
class3...(timeout=0,uid=-1,gid=-1)
(Setting umask to 77)
cfengine:hsysnav02:/bin/echo class: class3
cfengine:hsysnav02: Finished script /bin/echo class3


On 2/14/06, David E. Nelson <david.nelson@ni.com> wrote:
>
> Hi Brian,
>
> How about something like this.  Regarding your actionsequence, how about
> 'actionsequence = ( processes.pre shellcommands processes.post )'.  I'm not
> familiar w/ Debian start/stop scripts so I'm showing solaris versions to get
> the point across.
>
> processes:
>    pre.solaris::
>      "lpsched$" # Systems do not run print services
>        matches=0 # Do nothing if we match this number.
>        action=bymatch
>        define=solaris_lpsched_stop
>
>    post.solaris::
>      <whatever else>
>
> shellcommands:
>    solaris_lpsched_stop::
>      "/etc/init.d/lp stop ; rm /etc/rc2.d/S*lp"
>
> Regards,
>          /\/elson
>
>
>
> On Tue, 14 Feb 2006, Brian E. Seppanen wrote:
>
> > I have my actionsequence as
> >
> > actionsequence = ( shellcommands processes )
> >
> > I am loath to modify that order because sometimes a shellcommand is going to
> > trigger a process restart.
> >
> > I have enountered a situation though where I want to do a process check to
> > see if a specific process is running
> >
> > such as
> >
> > processes:
> >    debian::
> >         "rpc.statd" signal=term define=servicesremove
> >         "portmap" signal=term define=servicesremove
> >
> >
> > servicesremove.shellcommands:
> >    debian::
> >        "/usr/bin/env PATH=/sbin:/usr/sbin:/bin/:/usr/bin:/usr/local/bin
> > /usr/sbin/update-rc.d -f nfs-common remove"
> >         "/usr/bin/env PATH=/sbin:/usr/sbin:/bin/:/usr/bin:/usr/local/bin
> > /usr/sbin/update-rc.d -f nfs-kernel remove"
> >         "/usr/bin/env PATH=/sbin:/usr/sbin:/bin/:/usr/bin:/usr/local/bin
> > /usr/sbin/update-rc.d -f portmap remove"
> >
> >
> > How do I trigger this action to occur only if the identified process is
> > matched?   The servicesremove is being activiated even if the process is not
> > running and is occurring every time.
> >
> >
> > BTW:  Anyone running a later cfengine version 2.1.17, 2.1.18 successfully on
> > linux sparc64?
> >
> >
> > Thanks,
> >
> >
> > Brian Seppanen
> > 608.826.1464
> >
> >
> > _______________________________________________
> > Help-cfengine mailing list
> > Help-cfengine@gnu.org
> > http://lists.gnu.org/mailman/listinfo/help-cfengine
> >
>
> --
> ~~ ** ~~ If you don't think too well, then don't think too much. ~~ ** ~~
>
>
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-cfengine
>


--
Christian Pearce




reply via email to

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