Add MAILTO for backup crontab
This commit is contained in:
parent
2097136844
commit
43d8df3c5d
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2022 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -65,6 +65,7 @@ def deploy_backup_app(c, deploy, envname, mkvirtualenv=True, user='rattail',
|
|||
rattail_backup_script=None,
|
||||
everything=None,
|
||||
crontab=None,
|
||||
crontab_mailto=None,
|
||||
runat=UNSPECIFIED,
|
||||
logrotate=False,
|
||||
context={}):
|
||||
|
@ -225,6 +226,13 @@ def deploy_backup_app(c, deploy, envname, mkvirtualenv=True, user='rattail',
|
|||
crontab_context['envname'] = envname
|
||||
crontab_context['pretty_time'] = runat.strftime('%I:%M %p')
|
||||
crontab_context['cron_time'] = runat.strftime('%M %H')
|
||||
|
||||
if crontab_mailto:
|
||||
if isinstance(crontab_mailto, str):
|
||||
crontab_mailto = [crontab_mailto]
|
||||
crontab_mailto = ','.join(crontab_mailto)
|
||||
crontab_context['mailto'] = crontab_mailto
|
||||
|
||||
if crontab:
|
||||
deploy(c, crontab, '/etc/cron.d/backup', context=crontab_context, use_sudo=True)
|
||||
else:
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
# -*- mode: conf; -*-
|
||||
|
||||
% if mailto:
|
||||
MAILTO="${mailto}"
|
||||
% endif
|
||||
|
||||
# backup everything of importance at ${pretty_time}
|
||||
${'' if env.machine_is_live else '# '}${cron_time} * * * root /usr/local/bin/backup-everything
|
||||
|
|
Loading…
Reference in a new issue