help-cfengine
[Top][All Lists]
Advanced

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

RE: How to copy, alert and shellcommand


From: Anton Krall
Subject: RE: How to copy, alert and shellcommand
Date: Fri, 27 Aug 2004 12:16:36 -0500

Thx for the detailed explanation John, I just think that the docs are
sometimes confusing but getting along :)

Thank you again!

------------------------------------
Intruder Consulting
Anton Krall
Director General
akrall@intruder.com.mx
tel: 5781-5112
mobile: 1325-3511
IM: akrall@intruder.com.mx
www.intruder.com.mx
------------------------------------
 

%-----Original Message-----
%From: Wheeler, John [mailto:jwheeler@eb.com] 
%Sent: Viernes, 27 de Agosto de 2004 11:02 a.m.
%To: Anton Krall; Mark.Burgess@iu.hio.no
%Cc: help-cfengine@gnu.org
%Subject: RE: How to copy, alert and shellcommand 
%
%> Im new to cfengine, can you explain a bit furtherwhat the 
%example does 
%> part by part?
%> %control:
%
%The control[1] section defines what cfagent will do when run. 
%In this case we have two directives. The first one (arguable 
%the most important) actionsequence is as the name implies a 
%sequence of actions that the agent will execute in the order 
%they appear in the list. In this case the action of "copy"[3] 
%followed by "shellcommands"[4] will be executed.
%This definition in itself does nothing; you must define in the 
%corresponding sections what syntactically correct "action" to take.
%
%[1] http://www.cfengine.org/docs/cfengine-Reference.html#control
%[2] http://www.cfengine.org/docs/cfengine-Reference.html#actionsequence
%[3] http://www.cfengine.org/docs/cfengine-Reference.html#copy
%[4] http://www.cfengine.org/docs/cfengine-Reference.html#shellcommands
%
%
%> %
%> % actionsequence = ( copy shellcommands ) % % 
%AddInstallables = ( blah 
%> )
%
%The second directive AddInstallable[5] is intended to help the 
%cfagent parser optimize "code" included by the activation of 
%the class "blah"[6] that may otherwise be excluded if the 
%class were not activated[7]. I'll explain this further when 
%the class is used.
%
%[5]http://www.cfengine.org/docs/cfengine-Reference.html#addinstallable
%[6]My personal favorite "example" variable.
%[7]For reasons beyond comprehension, sorry mark.
%
%> %
%> %copy:
%
%Ahhhh... our first "action" section, copy. This section says "from"
%which is intended to indicate the source path of the file to 
%copy. Say you want to copy /etc/hosts from somewhere (locally 
%or remotely). The copy section would look like
%
%copy:
%    /etc/hosts
%        dest=/etc/hosts
%
%Also note the define statement. This is where our mysterious "blah"
%class shows up. From reading the documentation one would come 
%to realize that this class will be defined if and only if the 
%file is copied. 
%
%> %
%> %  from dest=to define=blah
%> %
%> %shellcommands:
%
%
%This is where we define the shellcommands. Note that even 
%though the order of these sections (shellcommands and copy) 
%happens to follow the order in the action sequence, the order 
%is irrelevant. The action sequence dictates the order of events.
%
%Notice here that the bogus shellcommand (fully pathed!) 
%/bin/runme will not be run unless the blah class is set.  This 
%is why the addinstallable is important, because the class blah 
%is a dynamic class, activated by another action, the parser 
%would otherwise ignore this section of the shellcommands had 
%we not place this class in the addinstallable directive.
%
%> %
%> %  blah::
%> %
%> %     "/bin/runme balbla"
%> %
%> %alerts:
%
%I honestly can't speak intelligently about alerts, I just 
%don't use them... yet. Basically, using the dynamic class 
%"blah" again, the message in quotes below will be puked to the 
%screen or arrive in an email (assuming you've set the 
%sysadmin[8]) if and only if the file in question is copied.
%
%[8] http://www.cfengine.org/docs/cfengine-Reference.html#sysadm
%
%
%> %
%> %  blah::
%> %
%> %    "I was copied"
%> %
%> %
%
%My best advice is to spend a bit of time reading both the 
%reference[9] and the tutorial[10] thoroughly. These are 
%invaluable sources of information. Also, google is your 
%friend. Finally, setup a test environment to perform simple 
%examples and convince yourself of its functionality.
%
%
%[9]http://www.cfengine.org/docs/cfengine-Reference.html
%[10]http://www.cfengine.org/docs/cfengine-Tutorial.html
%





reply via email to

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