-K allows to specify which apps to cron, thanks Jonathan
This commit is contained in:
+21
-15
@@ -911,14 +911,6 @@ def start(cron=True):
|
||||
test(options.test, verbose=options.verbose)
|
||||
return
|
||||
|
||||
# ## if -K
|
||||
if options.scheduler:
|
||||
try:
|
||||
start_schedulers(options)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
return
|
||||
|
||||
# ## if -S start interactive shell (also no cron)
|
||||
if options.shell:
|
||||
if not options.args is None:
|
||||
@@ -928,21 +920,35 @@ def start(cron=True):
|
||||
return
|
||||
|
||||
# ## if -C start cron run (extcron) and exit
|
||||
# ## if -N or not cron disable cron in this *process*
|
||||
# ## if --softcron use softcron
|
||||
# ## use hardcron in all other cases
|
||||
# ## -K specifies optional apps list (overloading scheduler)
|
||||
if options.extcron:
|
||||
print 'Starting extcron...'
|
||||
logger.debug('Starting extcron...')
|
||||
global_settings.web2py_crontype = 'external'
|
||||
extcron = newcron.extcron(options.folder)
|
||||
if options.scheduler: # -K
|
||||
apps = [app.strip() for app in options.scheduler.split(',')]
|
||||
else:
|
||||
apps = None
|
||||
extcron = newcron.extcron(options.folder, apps=apps)
|
||||
extcron.start()
|
||||
extcron.join()
|
||||
return
|
||||
elif cron and not options.nocron and options.softcron:
|
||||
|
||||
# ## if -K
|
||||
if options.scheduler:
|
||||
try:
|
||||
start_schedulers(options)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
return
|
||||
|
||||
# ## if -N or not cron disable cron in this *process*
|
||||
# ## if --softcron use softcron
|
||||
# ## use hardcron in all other cases
|
||||
if cron and not options.nocron and options.softcron:
|
||||
print 'Using softcron (but this is not very efficient)'
|
||||
global_settings.web2py_crontype = 'soft'
|
||||
elif cron and not options.nocron:
|
||||
print 'Starting hardcron...'
|
||||
logger.debug('Starting hardcron...')
|
||||
global_settings.web2py_crontype = 'hard'
|
||||
newcron.hardcron(options.folder).start()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user