237.1.7
by James Westby
Add the script to be cronned to add import jobs. |
1 |
#!/usr/bin/python
|
2 |
||
3 |
import os |
|
4 |
import sys |
|
5 |
||
6 |
sys.path.insert(0, os.path.dirname(__file__)) |
|
7 |
import icommon |
|
8 |
||
333
by James Westby
Add locking to cron jobs to prevent runaway problems when they are slow. |
9 |
lock = icommon.lock_add_import_jobs() |
10 |
if lock is None: |
|
11 |
print "Another instance of add_import_jobs is already running." |
|
12 |
sys.exit(0) |
|
13 |
try: |
|
14 |
lp = icommon.get_lp() |
|
15 |
status_db = icommon.StatusDatabase(icommon.sqlite_file) |
|
16 |
||
17 |
icommon.create_import_jobs(lp, status_db) |
|
18 |
finally: |
|
19 |
lock.close() |