Files
tryton/trytond/bin/trytond-cron
T

34 lines
889 B
Python
Raw Normal View History

2018-06-26 19:11:19 +02:00
#!/usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
2016-03-15 16:57:26 +01:00
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import os
2021-12-11 17:58:45 +01:00
import sys
2016-03-15 16:57:26 +01:00
try:
import argcomplete
except ImportError:
argcomplete = None
2016-03-15 16:57:26 +01:00
DIR = os.path.abspath(os.path.normpath(os.path.join(__file__,
'..', '..', 'trytond')))
if os.path.isdir(DIR):
sys.path.insert(0, os.path.dirname(DIR))
import trytond.commandline as commandline
from trytond.config import config
2020-07-25 08:03:02 +02:00
parser = commandline.get_parser_cron()
if argcomplete:
argcomplete.autocomplete(parser)
2016-03-15 16:57:26 +01:00
options = parser.parse_args()
config.update_etc(options.configfile)
commandline.config_log(options)
2021-12-11 17:58:45 +01:00
import trytond.cron as cron
2017-05-30 17:07:12 +02:00
# Import after application is configured
from trytond.pool import Pool
2017-05-30 17:07:12 +02:00
2016-03-15 16:57:26 +01:00
with commandline.pidfile(options):
Pool.start()
2019-03-22 12:17:50 +01:00
cron.run(options)