help-cfengine
[Top][All Lists]
Advanced

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

Re: Restart daemon after config change


From: Kief Morris
Subject: Re: Restart daemon after config change
Date: Thu, 18 Dec 2003 14:57:29 +0000

Alexander Mattausch typed the following on 15:11 18/12/2003 +0100
>Kief Morris schrieb:
>>I want to find a way to restart daemons when their configuration files
>>have been changed. I thought I might use file checksum monitoring
>>to set a class (eg. "bind_needs_restart") that would later trigger
>>a shellcommand to run the init script ("/etc/init.d/bind9 reload").
>>
>>However, the define attribute isn't triggered when the checksum
>>changes, so that's a no-go.
>
>Add the following:
>
>control:
>  AddInstallable = ( bind_needs_restart )

It still doesn't work. I can see why I would need this, but from the
documentation, it looks like the define= attribute only works if the
file statement causes the file to be changed - it specifically says
it doesn't set the class if there is only a warning. Have you got it
working this way?


More details on my configuration:

control:

        actionsequence  = 
        ( 
                checktimezone 
                netconfig
                resolve
                addmounts
                mountall
                copy
                editfiles
                links
                directories
                files
                tidy
                shellcommands
        )

        AddInstallable = ( bind_needs_restart )
        ChecksumDatabase  = ( /var/cfengine/cache.db )
        ChecksumUpdates   = ( on )


files:

        dnsserver::
                /var/named
                        recurse=1 
                        action=warnall 
                        checksum=md5
                        define=bind_needs_restart

shellcommands:

        dnsserver.bind_needs_restart::
                "/bin/echo reloading bind"
                "/etc/init.d/bind9 reload"


The files statement triggers a warning that a file in /var/named has changed, 
but
even with verbose output it doesn't mention the class being set:

cfengine:europa: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
cfengine:europa: SECURITY ALERT: Checksum for /var/named/syzygy.net changed!
cfengine:europa: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Updating checksum for /var/named/syzygy.net to 
MD5=4d1b2571b89b008fca0ad3c04a53ce3f
...

and the shellcommands section doesn't produce any output.

*********************************************************************
 Main Tree Sched: shellcommands pass 2 @ Thu Dec 18 14:49:00 2003
*********************************************************************


Thanks,
Kief





reply via email to

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