Make each overnight script optional

trying to phase out at least 1, maybe 2 of them...

this also cleans up the 'restart' script to use 'rattail overnight'
per recent changes.  this seems the most useful to have around, in
case of web app failure
This commit is contained in:
Lance Edgar 2022-11-20 20:02:48 -06:00
parent a36ecdb2ad
commit 25891902b8
3 changed files with 41 additions and 34 deletions

View file

@ -1,10 +1,4 @@
#!/bin/sh -e
<%text>############################################################</%text>
#
# overnight automation (${automation}) via cron
#
<%text>############################################################</%text>
cd ${envroot}
@ -15,4 +9,5 @@ $RATTAIL overnight ${automation.lower()} <%text>\</%text>
% if email_key is not Undefined and email_key:
--email-key '${email_key}' <%text>\</%text>
% endif
--no-email-if-empty
--no-email-if-empty <%text>\</%text>
--wait

View file

@ -1,5 +1,13 @@
#!/bin/sh -e
DATE=`date --date='yesterday' +%Y-%m-%d`
cd ${envroot}
echo "${envroot}/bin/rattail -c ${appdir}/cron.conf --no-versioning run-n-mail ${"--key '{}'".format(email_key) if email_key is not Undefined and email_key else ''} -S 'Overnight catch-up: ${automation}' '${appdir}/overnight-${automation.lower()}.sh $DATE'" | at 'now + 1 minute'
RATTAIL="bin/rattail --config=app/cron.conf"
$RATTAIL overnight ${automation.lower()} <%text>\</%text>
--no-versioning <%text>\</%text>
% if email_key is not Undefined and email_key:
--email-key '${email_key}' <%text>\</%text>
% endif
--email-if-empty <%text>\</%text>
--no-wait

View file

@ -73,7 +73,8 @@ def install_luigi(c, envroot, luigi='luigi', user='rattail', db_connection=None)
def install_overnight_script(c, envroot, user='rattail', automation='All',
email_key=None):
email_key=None,
luigi=True, cron=True, restart=True):
"""
Install an overnight automation script
"""
@ -81,6 +82,7 @@ def install_overnight_script(c, envroot, user='rattail', automation='All',
appdir = '{}/app'.format(envroot)
# overnight-*.sh
if luigi:
filename = 'overnight-{}.sh'.format(automation.lower())
deploy_common(c, 'luigi/overnight.sh.mako',
'{}/{}'.format(appdir, filename),
@ -89,6 +91,7 @@ def install_overnight_script(c, envroot, user='rattail', automation='All',
'automation': automation})
# cron-overnight-*.sh
if cron:
filename = 'cron-overnight-{}.sh'.format(automation.lower())
deploy_common(c, 'luigi/cron-overnight.sh.mako',
'{}/{}'.format(appdir, filename),
@ -98,6 +101,7 @@ def install_overnight_script(c, envroot, user='rattail', automation='All',
'email_key': email_key})
# restart-overnight-*.sh
if restart:
filename = 'restart-overnight-{}.sh'.format(automation.lower())
deploy_common(c, 'luigi/restart-overnight.sh.mako',
'{}/{}'.format(appdir, filename),