Provide default crontab for luigi, to rotate logs and restart

This commit is contained in:
Lance Edgar 2023-01-08 12:41:25 -06:00
parent 8c556e6176
commit 6fb9389e45
2 changed files with 10 additions and 2 deletions

View file

@ -0,0 +1,4 @@
## -*- mode: conf; -*-
# rotate logs and restart Luigi at *just before* 12:00am midnight
55 23 * * * root ${appdir}/rotate-luigi-logs.sh

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2022 Lance Edgar
# Copyright © 2010-2023 Lance Edgar
#
# This file is part of Rattail.
#
@ -32,7 +32,8 @@ from rattail_fabric2 import make_deploy, mkdir
deploy_common = make_deploy(__file__)
def install_luigi(c, envroot, luigi='luigi', user='rattail', db_connection=None):
def install_luigi(c, envroot, luigi='luigi', user='rattail', db_connection=None,
crontab=False):
"""
Install and configure Luigi to the given virtualenv.
"""
@ -70,6 +71,9 @@ def install_luigi(c, envroot, luigi='luigi', user='rattail', db_connection=None)
deploy_common(c, 'luigi/rotate-logs.sh.mako', '{}/rotate-luigi-logs.sh'.format(appdir),
use_sudo=True, owner=user,
context={'appdir': appdir})
if crontab:
deploy_common(c, 'luigi/crontab.mako', '/etc/cron.d/luigi',
use_sudo=True, context={'appdir': appdir})
def install_overnight_script(c, envroot, user='rattail', automation='All',