Forum: CFEngine Help Subject: Re: execresult evaluated multiple times? Author: sauer Link to topic: https://cfengine.com/forum/read.php?3,25496,25508#msg-25508
Use a commands promise, set a class when the promise is kept or repaired (I suggest the if_ok body from COPBL), and only execute the command if the class is not set. That way, it'll only run on the first pass. To retain the output in a variable, use the module protocol (see the reference manual), and either wrap the command in a shell script or pipe it through a command (sed, whatever) that sticks the "$var=" string in front of the output. This is why I almost never use execresult, BTW. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine