Changeset 824

Show
Ignore:
Timestamp:
03/26/2006 07:37:13 AM (3 years ago)
Author:
mtaylor
Message:

Added "RESCANCONFIGS" config option. Defaults to original behavior.

This option allows the disabling of Eddie's constant scanning and reloading
if its config files.

Location:
eddie/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • eddie/trunk/bin/eddie.py

    r822 r824  
    453453            # check if any config/rules files have been modified 
    454454            # if so, re-read config 
    455             if Config.checkfiles(): 
     455            if config.rescan_configs and Config.checkfiles(): 
    456456                log.log( '<eddie>main(): config files modified - signalling scheduler to die', 7 ) 
    457457                stop_threads() 
  • eddie/trunk/config.sample/eddie.cf

    r731 r824  
    146146 
    147147 
     148# RESCANCONFIGS 
     149#  Normally Eddie will constantly check its config files for changes, and 
     150#  re-load them after stopping the threads.  This flag can turn off that 
     151#  behavior.  If it is set to 1, then you can still send Eddie a HUP signal 
     152#  to have it reload the configs. 
     153 
     154#RESCANCONFIGS=0 
     155 
     156 
     157 
    148158# CLASS 
    149159#  Define classes of hosts which share the same Eddie config.  The name of the 
  • eddie/trunk/doc/manual.html

    r821 r824  
    193193    <li> <b><a name="WORKDIR">WORKDIR</a></b> 
    194194         - directory where Eddie can store temporary files.  [Eddie 0.35+] 
     195    <li> <b><a name="RESCANCONFIGS">RESCANCONFIGS</a></b> 
     196         - Flag indicating the desire to constantly scan (and reload) config file changes. Defaults to true. 
    195197    <li> <b>CLASS</b> - a grouping of hosts which share the same directives. 
    196198    <li> <b>ALIAS</b> - global aliases can be set here, if required. 
  • eddie/trunk/lib/common/config.py

    r806 r824  
    7373## 
    7474consport=33343 
     75 
     76 
     77## 
     78## Constantly rescan config files for changes? 0/1 
     79## Set with RESCANCONFIGS in config. 
     80## 
     81rescan_configs = 1 
     82 
    7583 
    7684#################################################### 
     
    419427        # ok, value is 3rd list element 
    420428        global num_threads 
    421         num_threads = int(list[2])              # set the config option 
     429        try: 
     430           num_threads = int(list[2])           # set the config option 
     431        except TypeError:                               # must be integer 
     432            raise ParseFailure, "NUMTHREADS is not an integer, '%s'" % (list[2]) 
     433 
    422434        log.log( "<config>NUMTHREADS: num_threads set to '%d'." % (num_threads), 8 ) 
    423435 
     
    545557        log.log( "<config>WORKDIR: set to '%s'" % (self.workdir), 8 ) 
    546558 
     559 
     560 
     561class RESCANCONFIGS(ConfigOption): 
     562    """Set the boolean indicating desire to constantly check for config file changes and reload.""" 
     563 
     564    def __init__( self, list, typelist ): 
     565        apply( ConfigOption.__init__, (self,list, typelist) ) 
     566 
     567        # if we don't have 3 elements ['RESCANCONFIGS', '=', <val>] then 
     568        # raise an error 
     569        if len(list) != 3: 
     570            raise ParseFailure, "RESCANCONFIGS definition has %d tokens when expecting 3" % len(list) 
     571 
     572        # ok, value is 3rd list element 
     573        global rescan_configs 
     574        try: 
     575            rescan_configs = int(list[2])               # set the config option 
     576        except TypeError:                               # must be integer 
     577            raise ParseFailure, "RESCANCONFIGS is not an integer, '%s'" % (list[2]) 
     578 
     579        log.log( "<config>RESCANCONFIGS(): rescan_configs set to '%d'." % (rescan_configs), 8 ) 
    547580 
    548581 
     
    610643                "SMTP_SERVERS"  : SMTP_SERVERS, 
    611644                "WORKDIR"       : WORKDIR, 
     645                "RESCANCONFIGS" : RESCANCONFIGS, 
    612646           } 
    613647