bundles/cron: provide some environment, also manage /etc/crontab
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2020-11-09 18:22:41 +01:00
parent 1ffe8bd23e
commit 67386d9efa
Signed by: kunsi
GPG key ID: 12E3D2136B818350
4 changed files with 50 additions and 2 deletions

View file

@ -0,0 +1,14 @@
# __ ____
# / /_ __ ______ ____/ / /__ _ ___________ _____
# / __ \/ / / / __ \/ __ / / _ \ | /| / / ___/ __ `/ __ \
# / /_/ / /_/ / / / / /_/ / / __/ |/ |/ / / / /_/ / /_/ /
#/_.___/\__,_/_/ /_/\__,_/_/\___/|__/|__/_/ \__,_/ .___/
# /_/
#
# CAUTION! This file is managed with bundlewrap.
# Any manual edits will be lost!
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
${cron}

View file

@ -0,0 +1,17 @@
# __ ____
# / /_ __ ______ ____/ / /__ _ ___________ _____
# / __ \/ / / / __ \/ __ / / _ \ | /| / / ___/ __ `/ __ \
# / /_/ / /_/ / / / / /_/ / / __/ |/ |/ / / / /_/ / /_/ /
#/_.___/\__,_/_/ /_/\__,_/_/\___/|__/|__/_/ \__,_/ .___/
# /_/
#
# CAUTION! This file is managed with bundlewrap.
# Any manual edits will be lost!
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
${min} * * * * root cd / && run-parts --report /etc/cron.hourly
${min} 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
${min} 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
${min} 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

View file

@ -1,4 +1,11 @@
files = {}
files = {
'/etc/crontab': {
'content_type': 'mako',
'context': {
'min': (node.magic_number%60),
},
},
}
directories = {
'/etc/cron.d': {
@ -11,5 +18,9 @@ directories = {
for crontab, content in node.metadata.get('cron', {}).items():
files['/etc/cron.d/{}'.format(crontab)] = {
'content': content + "\n",
'source': 'cron_template',
'content_type': 'mako',
'context': {
'cron': content,
}
}

View file

@ -68,6 +68,12 @@ nodes['htz.ex42-1048908'] = {
},
},
},
'cron': {
# TODO move to a proper bundle
'backup': '0 1 * * * root /root/backup.sh',
'restart_mautrix_whatsapp': '0 3 * * * root systemctl restart matrix-bridge-whatsapp.service',
'telekom_nervkram': vault.decrypt('encrypt$gAAAAABfqXi23M96wrSLhqlbhqgePYX06LjPXfyQU2y_07kqYYLztj_PhS1-dk4r5FiiL2Ofmx5iCKW1sZNqiQSuHj2uKaitH0GnwHqj5CI2JwkAS9HrFxw=').format_into('0 0 * * * root date | mail -s \'daily test mail \' -r postmaster@mx0.kunbox.net {}'),
},
'gitea': {
'version': '1.12.5',
'sha256': '8ed8bff1f34d8012cab92943214701c10764ffaca102e311a3297edbb8fce940',