[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Cfexecd patch
From: |
Mark . Burgess |
Subject: |
Re: Cfexecd patch |
Date: |
Fri, 15 Oct 2004 22:38:17 +0200 (MEST) |
Good idea
M
On 15 Oct, Chip Seraphine wrote:
>
> Very minor patch for cfexecd that causes it to set a 'from_cfexecd' class in
> cfagent runs. This allows your cfengine scripts to Do Stuff based on whether
> or not the run was called from cfexecd. (In my environment, this is quite
> useful; for example, if I am being run from hand, I might wish to log
> different information than a 'regular' scheduled run from efexecd.)
>
> Patched against 2.1.10.
>
> 0-chip@mulva-08:42:04-../cfengine-2.1.10/src$ diff -u cfexecd.src.orig
> cfexecd.c
> --- cfexecd.src.orig 2004-10-08 10:46:11.600941000 -0500
> +++ cfexecd.c 2004-10-12 13:30:53.282950000 -0500
> @@ -213,7 +213,7 @@
>
> snprintf(VBUFF,CF_BUFSIZE,"%s/inputs/update.conf",WORKDIR);
> MakeDirectoriesFor(VBUFF,'y');
> -snprintf(VBUFF,CF_BUFSIZE,"%s/bin/cfagent",WORKDIR);
> +snprintf(VBUFF,CF_BUFSIZE,"%s/bin/cfagent -D from_cfexecd",WORKDIR);
> MakeDirectoriesFor(VBUFF,'y');
> snprintf(VBUFF,CF_BUFSIZE,"%s/outputs/spooled_reports",WORKDIR);
> MakeDirectoriesFor(VBUFF,'y');
> @@ -386,7 +386,7 @@
> char cfcom[CF_BUFSIZE];
> static char line[CF_BUFSIZE];
>
> -snprintf(cfcom,CF_BUFSIZE-1,"%s/bin/cfagent -z",WORKDIR);
> +snprintf(cfcom,CF_BUFSIZE-1,"%s/bin/cfagent -D from_cfexecd -z",WORKDIR);
>
> if ((pp=cfpopen(cfcom,"r")) == NULL)
> {
> @@ -569,11 +569,11 @@
>
> if (NOSPLAY)
> {
> - snprintf(cmd,CF_BUFSIZE-1,"%s/bin/cfagent -q",WORKDIR);
> + snprintf(cmd,CF_BUFSIZE-1,"%s/bin/cfagent -q -D from_cfexecd",WORKDIR);
> }
> else
> {
> - snprintf(cmd,CF_BUFSIZE-1,"%s/bin/cfagent",WORKDIR);
> + snprintf(cmd,CF_BUFSIZE-1,"%s/bin/cfagent -D from_cfexecd",WORKDIR);
> }
>
> snprintf(line,100,CanonifyName(ctime(&starttime)));
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Work: +47 22453272 Email: Mark.Burgess@iu.hio.no
Fax : +47 22453205 WWW : http://www.iu.hio.no/~mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~