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 -*-
|
||||
|
||||
"""
|
||||
@@ -279,8 +278,7 @@ class cronlauncher(threading.Thread):
|
||||
|
||||
def crondance(applications_parent, ctype='soft', startup=False, apps=None):
|
||||
apppath = os.path.join(applications_parent, 'applications')
|
||||
cron_path = os.path.join(applications_parent)
|
||||
token = Token(cron_path)
|
||||
token = Token(applications_parent)
|
||||
cronmaster = token.acquire(startup=startup)
|
||||
if not cronmaster:
|
||||
return
|
||||
@@ -314,9 +312,8 @@ def crondance(applications_parent, ctype='soft', startup=False, apps=None):
|
||||
if not os.path.exists(crontab):
|
||||
continue
|
||||
try:
|
||||
cronlines = fileutils.readlines_file(crontab, 'rt')
|
||||
lines = [x.strip() for x in cronlines if x.strip(
|
||||
) and not x.strip().startswith('#')]
|
||||
cronlines = [line.strip() for line in fileutils.readlines_file(crontab, 'rt')]
|
||||
lines = [line for line in cronlines if line and not line.startswith('#')]
|
||||
tasks = [parsecronline(cline) for cline in lines]
|
||||
except Exception as e:
|
||||
logger.error('WEB2PY CRON: crontab read error %s' % e)
|
||||
|
||||
Reference in New Issue
Block a user