|
From: | Alexander Mattausch |
Subject: | Re: conditional file copy |
Date: | Thu, 02 Oct 2003 10:02:19 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.4) Gecko/20030624 |
Jason Allen schrieb:
Is there anyway to do something like the following with Cfengine? copy: any:: if(filexists$(linuxfiles)/passwd.$(host)){ $(linuxfiles)/passwd.$(host) }else{ $(linuxfiles)/passwd } dest=/etc/passwd server=$(cfserver) mode=644 type=sum In other words I'd like cfengine to copy passwd.$hostname if it exists and if not copy passwd.
Your example script not the cfengine way of thinking. All conditional actions are determined by defined or undefined classes and not by if/else statements.
What you probably want is the singlecopy option: control: singlecopy = ( on ) copy: /distdir/${host}/passwd dest=/etc/passwd server=... /distdir/all/passwd dest=/etc/passwd server=...(This is extensively copied from the cfengine reference manual, I recommend having a look at the the singlecopy-option in there).
Regards, Alex
[Prev in Thread] | Current Thread | [Next in Thread] |