code simplificatons in newcron (although deprecated), thanks Paolo Pastori
This commit is contained in:
+3
-6
@@ -1,4 +1,3 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -279,8 +278,7 @@ class cronlauncher(threading.Thread):
|
|||||||
|
|
||||||
def crondance(applications_parent, ctype='soft', startup=False, apps=None):
|
def crondance(applications_parent, ctype='soft', startup=False, apps=None):
|
||||||
apppath = os.path.join(applications_parent, 'applications')
|
apppath = os.path.join(applications_parent, 'applications')
|
||||||
cron_path = os.path.join(applications_parent)
|
token = Token(applications_parent)
|
||||||
token = Token(cron_path)
|
|
||||||
cronmaster = token.acquire(startup=startup)
|
cronmaster = token.acquire(startup=startup)
|
||||||
if not cronmaster:
|
if not cronmaster:
|
||||||
return
|
return
|
||||||
@@ -314,9 +312,8 @@ def crondance(applications_parent, ctype='soft', startup=False, apps=None):
|
|||||||
if not os.path.exists(crontab):
|
if not os.path.exists(crontab):
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
cronlines = fileutils.readlines_file(crontab, 'rt')
|
cronlines = [line.strip() for line in fileutils.readlines_file(crontab, 'rt')]
|
||||||
lines = [x.strip() for x in cronlines if x.strip(
|
lines = [line for line in cronlines if line and not line.startswith('#')]
|
||||||
) and not x.strip().startswith('#')]
|
|
||||||
tasks = [parsecronline(cline) for cline in lines]
|
tasks = [parsecronline(cline) for cline in lines]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error('WEB2PY CRON: crontab read error %s' % e)
|
logger.error('WEB2PY CRON: crontab read error %s' % e)
|
||||||
|
|||||||
Reference in New Issue
Block a user