help-cfengine
[Top][All Lists]
Advanced

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

How to restart daemons on redhat|fedora??


From: Guolin Cheng
Subject: How to restart daemons on redhat|fedora??
Date: Fri, 2 Jul 2004 11:48:59 -0700

Hi, all,

 

 Got a silly question on how to restart daemons using “/etc/init.d/<service> restart” through cfengine…

 

 The question can be detailed as:  After a new configuration is ready and pushed out to clients by means of cfengine, how to setup cfengine to restart daemons through “/etc/init.d/<serviceDaemonScript> restart|reload” shell commands. The existing “restart <shell command>” substatement in processes section doesn’t help a lot since it requires the matched processes should die hard first according to manual. The following are cut from references:

 

…..

restart "shell command"

Note the syntax: there is no equals sign here. If the keyword `restart' appears, then the next quoted string is interpreted as a shell command which is to be executed after any signals have been sent. This command is only issued if the number of processes matching the specified regular _expression_ is zero, or if the signal sent was signal 9 (sigkill) or 15 (sigterm) , i.e. the normal termination signals. This could be used to restart a daemon for instance. …

…..

 

For my case, I’d like to restart samba daemons, smbd and nmbd, after I push out a new /etc/samba/smb.conf. My configuration file is something like the following:

 

 control:

   actionsequence = ( copy processes … )

….

   AddInstallable = ( new_samba_config )

….

copy:

# /etc/samba/smb.conf

   linux.webdevServers::

      $(master_cfconfigs)/webdevServers/etc/samba/smb.conf

                        dest=/etc/samba/smb.conf

                        mode=644

                        owner=root

                        group=root

                        type=checksum

                        server=$(policyhost)

                        define=new_samba_config

….

processes:

   new_samba_config::

   "smbd" signal=hup restart "/etc/init.d/smb reload"

….

 

But I’m afraid the above configuration will not restart my samba daemons at all, since I give the smbd process a “sighup” siginal instead of “sigkill” or “sigterm”.

Should I use the following statement instead? I hesitate to do that since it is a dirty hack ( I have to read the /etc/init.d/smb script and figure out that two daemons are fired up there).

….

processes:

   new_samba_config::

   "smbd" signal=kill

   “nmbd”  signal=kill  restart "/bin/rm –rf /var/run/smbd.pid /var/run/nmbd.pid; /etc/init.d/smb restart"

….

 

Any suggestions and opinions are greatly appreciated.

 

Thanks.

--Guolin Cheng

 

 

 

 

 

 

 

 

 


reply via email to

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