1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-12-22 07:17:05 +00:00

clean up the backup time patch: dont choose timezone here, move status checks into the same 3am script

This commit is contained in:
Joshua Tauberer 2015-12-26 08:39:22 -05:00
parent 8a35905d2e
commit a4d8e12fd7
3 changed files with 17 additions and 23 deletions

View File

@ -7,6 +7,7 @@ Still In Development
Mail:
* Update Roundcube to version 1.1.3.
* Nightly backups and system status checks are now moved to 3am in the system's timezone.
v0.14 (November 4, 2015)
------------------------

8
management/daily_tasks.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
# This script is run daily (at 3am each night).
# Take a backup.
management/backup.py
# Run status checks and email the administrator if anything changed.
management/status_checks.py --show-changes --smtp

View File

@ -30,33 +30,18 @@ rm -f /etc/init.d/mailinabox
ln -s $(pwd)/conf/management-initscript /etc/init.d/mailinabox
hide_output update-rc.d mailinabox defaults
# Set time zone to something convenient for the user
# Backup will be set for 3am localtime so choice is important depending
# on user locations.
# Remove old files we no longer use.
rm -f /etc/cron.daily/mailinabox-backup
rm -f /etc/cron.daily/mailinabox-statuschecks
dpkg-reconfigure tzdata
# Perform nightly tasks at 3am in system time: take a backup, run
# status checks and email the administrator any changes.
# Perform a daily backup.
if [ -f /etc/cron.daily/mailinabox-backup ]; then
rm /etc/cron.daily/mailinabox-backup
fi
cat > /etc/cron.d/mailinabox-backup << EOF;
# /etc/cron.d/mailinabox-backup: crontab fragment to run maininabox-backup
# This executes $(pwd)/management/backup.py at 3am.
0 3 * * * root $(pwd)/management/backup.py
EOF
# Perform daily status checks. Compare each day to the previous
# for changes and mail the changes to the administrator.
cat > /etc/cron.daily/mailinabox-statuschecks << EOF;
#!/bin/bash
cat > /etc/cron.d/mailinabox-nightly << EOF;
# Mail-in-a-Box --- Do not edit / will be overwritten on update.
# Run status checks.
$(pwd)/management/status_checks.py --show-changes --smtp
# Run nightly tasks: backup, status checks.
0 3 * * * root (cd `pwd` && management/daily_tasks.sh)
EOF
chmod +x /etc/cron.daily/mailinabox-statuschecks
# Start it.
restart_service mailinabox