help-cfengine
[Top][All Lists]
Advanced

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

Re: SUMMARY: action copy options


From: Ted Zlatanov
Subject: Re: SUMMARY: action copy options
Date: Fri, 02 Aug 2002 13:32:52 -0400
User-agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.1 (sparc-sun-solaris2.6)

On Fri, 02 Aug 2002, slautier@lavache.com wrote:
> ******************************************************
> actionsequence = ( shellcommands.begin copy shellcommands.end )
> 
> copy:
>   $(master_dir)  dest=/tmp/hostnames
>                  r=1
>                  include=hosname.*
> 
> shellcommands:
>   begin::
>     mkdir "/tmp/hostnames"
> 
>   end::
>     "/bin/true; for file in `ls hostname.*`; do /bin/test ! -
> f /tmp/hostnames/$file && rm $file; done"
>     chdir=/etc
> 
>   "/bin/cp /tmp/hostnames/hostname.* /etc"
> 
>   "/bin/rm -Rf /tmp/hostnames"
> ******************************************************

Just some suggestions:

actionsequence = ( directories copy shellcommands)

directories:
 /tmp/hostnames
 /tmp/hostnames.backups

copy:
 $(master_dir)  dest=/tmp/hostnames r=1 include=hostname.*

shellcommands:
 "/usr/bin/rsync -a --backup --backup-dir=/tmp/hostnames.backups 
/tmp/hostnames/hostname.* /etc"
 "/bin/rm -rf /tmp/hostnames"

You could also use "cp -f" instead of the rsync; the GNU cp even has a
--backup option.  Anything to avoid the gap between the shell loop and
the file copy you have would be a good thing (in case, as you point
out, the server is rebooted or something else unpleasant happens).

> The main pb is that we copy all $(master_dir)/hostname.* files 
> in /tmp/hostnames whereas some might not need to be updated =>
> this solution generates network trafic even if we don't need it.

It's pretty minimal traffic though.  You could do a pull signalled
from the server if you're concerned about bandwidth.

Ted



reply via email to

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