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:
parent
a36ecdb2ad
commit
25891902b8
|
@ -1,10 +1,4 @@
|
|||
#!/bin/sh -e
|
||||
<%text>############################################################</%text>
|
||||
#
|
||||
# overnight automation (${automation}) via cron
|
||||
#
|
||||
<%text>############################################################</%text>
|
||||
|
||||
|
||||
cd ${envroot}
|
||||
|
||||
|
@ -12,7 +6,8 @@ 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
|
||||
--no-email-if-empty
|
||||
% if email_key is not Undefined and email_key:
|
||||
--email-key '${email_key}' <%text>\</%text>
|
||||
% endif
|
||||
--no-email-if-empty <%text>\</%text>
|
||||
--wait
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,31 +82,34 @@ def install_overnight_script(c, envroot, user='rattail', automation='All',
|
|||
appdir = '{}/app'.format(envroot)
|
||||
|
||||
# overnight-*.sh
|
||||
filename = 'overnight-{}.sh'.format(automation.lower())
|
||||
deploy_common(c, 'luigi/overnight.sh.mako',
|
||||
'{}/{}'.format(appdir, filename),
|
||||
use_sudo=True, owner=user, mode='0755',
|
||||
context={'envroot': envroot, 'appdir': appdir,
|
||||
'automation': automation})
|
||||
if luigi:
|
||||
filename = 'overnight-{}.sh'.format(automation.lower())
|
||||
deploy_common(c, 'luigi/overnight.sh.mako',
|
||||
'{}/{}'.format(appdir, filename),
|
||||
use_sudo=True, owner=user, mode='0755',
|
||||
context={'envroot': envroot, 'appdir': appdir,
|
||||
'automation': automation})
|
||||
|
||||
# cron-overnight-*.sh
|
||||
filename = 'cron-overnight-{}.sh'.format(automation.lower())
|
||||
deploy_common(c, 'luigi/cron-overnight.sh.mako',
|
||||
'{}/{}'.format(appdir, filename),
|
||||
use_sudo=True, owner=user, mode='0755',
|
||||
context={'envroot': envroot,
|
||||
'automation': automation,
|
||||
'email_key': email_key})
|
||||
if cron:
|
||||
filename = 'cron-overnight-{}.sh'.format(automation.lower())
|
||||
deploy_common(c, 'luigi/cron-overnight.sh.mako',
|
||||
'{}/{}'.format(appdir, filename),
|
||||
use_sudo=True, owner=user, mode='0755',
|
||||
context={'envroot': envroot,
|
||||
'automation': automation,
|
||||
'email_key': email_key})
|
||||
|
||||
# restart-overnight-*.sh
|
||||
filename = 'restart-overnight-{}.sh'.format(automation.lower())
|
||||
deploy_common(c, 'luigi/restart-overnight.sh.mako',
|
||||
'{}/{}'.format(appdir, filename),
|
||||
use_sudo=True, owner=user, mode='0755',
|
||||
context={'envroot': envroot,
|
||||
'appdir': appdir,
|
||||
'automation': automation,
|
||||
'email_key': email_key})
|
||||
if restart:
|
||||
filename = 'restart-overnight-{}.sh'.format(automation.lower())
|
||||
deploy_common(c, 'luigi/restart-overnight.sh.mako',
|
||||
'{}/{}'.format(appdir, filename),
|
||||
use_sudo=True, owner=user, mode='0755',
|
||||
context={'envroot': envroot,
|
||||
'appdir': appdir,
|
||||
'automation': automation,
|
||||
'email_key': email_key})
|
||||
|
||||
|
||||
def register_with_supervisor(c, envroot, user='rattail', autostart=False):
|
||||
|
|
Loading…
Reference in a new issue