help-cfengine
[Top][All Lists]
Advanced

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

RE: Configuring job to run every five minutes


From: Wheeler, John
Subject: RE: Configuring job to run every five minutes
Date: Tue, 6 May 2003 16:09:40 -0500

I modified the constants for cfexecd ( if you run cfagent with this
mechanism ) to allow it to run more frequently.

    264 /* #define exec_ifelapsed 5 */
    265 #define exec_ifelapsed 0
    266 /* #define exec_expireafter 10 */
    267 #define exec_expireafter 0
    268
"cf.defs.h" line 247 of 1683 --14%-- col 1

I didn't like the behavior this had though. I tried to prevent things
that should only run once an hour with IfElapsed and this didn't seem to
work. I haven't seen a response to an earlier post regarding this issue.

You may be better off running cfagent from cron.

The other thing I found out was that "Schedule" can not be a regular
class. It must be a time class. This is because when cfexecd start it
execs cfagent -z to determine its schedule (among other things). This
invocation doesn't appear to "resolve" nested classes.

My schedule looks like this:
schedule                = ( Min00 Min01 Min02 Min03 Min04 Min05
Min06 Min07 Min08 Min09 Min10 Min11 Min12 Min13 Min14 Min15 Min16 Min17
Min18 Mi
n19 Min20 Min21 Min22 Min23 Min24 Min25 Min26 Min27 Min28 Min29 Min30
Min31 Min3
2 Min33 Min34 Min35 Min36 Min37 Min38 Min39 Min40 Min41 Min42 Min43
Min44 Min45
Min46 Min47 Min48 Min49 Min50 Min51 Min52 Min53 Min54 Min55 Min56 Min57
Min58 Mi
n59 )

Another reason to reconsider using cfexecd for these monitor type
applications is that cfexecd will not start another cfagent process
until the first one completes. I found this to be a problem when a job I
had scheduled for 3:00am prevented another job at 5:00am from running
that day because the 3:00am job took longer than usual. If for some
reason your "check" of this critical system takes a while, or anything
else you have running at that particular interval exceeds the five
minute interval you've described, your check will not take place for two
intervals.

I've given up trying to shoehorn everything into a single
cfexecd/cfagent instance. I'm planning to have another cfagent process
run out of cron for these types of activities. I would use cfexecd, but
I can't pass classes to tell cfagent  how to behave so I'm just going to
invoke cfagent directly with something like

Cfagent -Dcron



> -----Original Message-----
> From: Albers, Lucas [mailto:luke@coe.montana.edu]
> Sent: Tuesday, May 06, 2003 2:11 PM
> To: 'help-cfengine@gnu.org'
> Subject: Configuring job to run every five minutes
> 
> How can I configure a cfagent job to run every five minutes?
> 
> According to the documentation it lists, you can configure to run at
an
> offset of the hour, but not run every 5 minutes.
> 
> http://www.cfengine.org/docs/cfengine-Reference.html
> In the section:
> Cfengine classes
> * A day of the week (in the form Monday Tuesday Wednesday..).
> * An hour of the day (in the form Hr00, Hr01 ... Hr23).
> * Minutes in the hour (in the form Min00, Min17 ... Min45).
> * A five minute interval in the hour (in the form Min00_05, Min05_10
...
> Min55_00)
> * A quart hour (in the form Q1, Q2, Q3, Q4)
> * An abbreviated time with quarter hour specified (in the form
Hr00_Q1,
> Hr23_Q4 etc.)
> * A day of the month (in the form Day1 ... Day31).
> * A month (in the form January, February, ... December).
> * A year (in the form Yr1997, Yr2001).
> 
> 
> I am trying to configure the system to check critical services every
five
> minutes and restart them if necessary.
> 
> Example, that is not quite correct:
> This only restarts the service on the 5 minute of the hour.
> 
> Min00_05::
> Linux::
>    "sendmail" restart "service sendmail start" inform=true
>    "sshd" restart "service sshd start" inform=true
>    "mysqld" restart "service mysqld start" inform=true
>    "ncftpd" restart "service ncftpd start" inform=true
>    "/usr/bin/postmaster" restart "service postgresql start"
inform=true
>    "smbd" restart "service smb start" inform true
>    "xfs" restart "service xfs start" inform=true
>    "httpd" restart "service httpd start" inform=true
>    "lpd" restart "service lpd start" inform=true
>    "nfsd" restart "service nfs start" inform=true
>    "identd" restart "service identd start" inform=true
>    "nscd" restart "service ncsd start" inform=true
> 
> 
> 
> Thanks for any help you can provide.
> 
> 
> 
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-cfengine




reply via email to

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