On Mon, Jul 04, 2011 at 05:13:23PM -0400, no-re...@cfengine.com wrote:
>Forum: CFEngine Help
>Subject: Editing a running a command
>Author: Koriv
>Link to topic: https://cfengine.com/forum/read.php?3,22722,22722#msg-22722
>
>I am getting started with cfengine2 recently and now, I am starting to have 
>some troubles with some tasks.

Before you get too far into configuring things, you may want to
seriously consider using version 3 instead.  

>The point is, I need to edit a file "/etc/sysctl.conf" (appending some
>lines only if they don't exist previously) and run a command "sysctl -p"
>(only if the file is edited). So I proceed creating an editfile for "A",
>so I can append the lines with a "AppendIfNoSuchLine" for every line. But,
>how can I run "sysctl -p" command only if, prevously, cfegine have edited
>the required file?

You need to set a new class when you make the edit, then write a promise
that will run your command when the class is set.

My CF2 is out of practice, but something like this should work:

editfiles:

        some_class::
                { /etc/sysctl.conf
                        AppendIfNoSuchLine "blah, blah, blah"
                        DefineInGroup "reload_sysctl_conf"
                }

shellcommands:
        reload_sysctl_conf::
                "/sbin/sysctl -p"






-- 
Jesse Becker
NHGRI Linux support (Digicon Contractor)
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to