kopia lustrzana https://github.com/piku/piku
Merge pull request #364 from puneet-mehta/feat/multiple-cron-support
feat(cron): added support for multiple cronspull/367/head
commit
26659479e5
|
@ -2,6 +2,7 @@
|
|||
# web: node server.js
|
||||
# release: make PROD=1
|
||||
# static: /:public,/somepath:somedir
|
||||
# cron: */5 * * * * python batch.py
|
||||
# cron1: */5 * * * * python batch.py
|
||||
# cron2: */5 * * * * python batch.py
|
||||
# somepyworker: python somescript.py
|
||||
# somenodeworker: node somescript.js
|
||||
|
|
6
piku.py
6
piku.py
|
@ -288,7 +288,7 @@ def parse_procfile(filename):
|
|||
try:
|
||||
kind, command = map(lambda x: x.strip(), line.split(":", 1))
|
||||
# Check for cron patterns
|
||||
if kind == "cron":
|
||||
if kind.startswith("cron"):
|
||||
limits = [59, 24, 31, 12, 7]
|
||||
res = match(CRON_REGEXP, command)
|
||||
if res:
|
||||
|
@ -1077,7 +1077,7 @@ def spawn_worker(app, kind, command, env, ordinal=1):
|
|||
echo("Error: malformed setting 'UWSGI_IDLE', ignoring it.".format(), fg='red')
|
||||
pass
|
||||
|
||||
if kind == 'cron':
|
||||
if kind.startswith("cron"):
|
||||
settings.extend([
|
||||
['cron', command.replace("*/", "-").replace("*", "-1")],
|
||||
])
|
||||
|
@ -1163,7 +1163,7 @@ def spawn_worker(app, kind, command, env, ordinal=1):
|
|||
settings.append(('attach-daemon', command))
|
||||
elif kind == 'static':
|
||||
echo("-----> nginx serving static files only".format(**env), fg='yellow')
|
||||
elif kind == 'cron':
|
||||
elif kind.startswith("cron"):
|
||||
echo("-----> uwsgi scheduled cron for {command}".format(**locals()), fg='yellow')
|
||||
else:
|
||||
settings.append(('attach-daemon', command))
|
||||
|
|
Ładowanie…
Reference in New Issue