Commit a4d8e12f authored by Joshua Tauberer's avatar Joshua Tauberer

clean up the backup time patch: dont choose timezone here, move status checks...

clean up the backup time patch: dont choose timezone here, move status checks into the same 3am script
parent 8a35905d
...@@ -7,6 +7,7 @@ Still In Development ...@@ -7,6 +7,7 @@ Still In Development
Mail: Mail:
* Update Roundcube to version 1.1.3. * 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) v0.14 (November 4, 2015)
------------------------ ------------------------
......
#!/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
...@@ -30,33 +30,18 @@ rm -f /etc/init.d/mailinabox ...@@ -30,33 +30,18 @@ rm -f /etc/init.d/mailinabox
ln -s $(pwd)/conf/management-initscript /etc/init.d/mailinabox ln -s $(pwd)/conf/management-initscript /etc/init.d/mailinabox
hide_output update-rc.d mailinabox defaults hide_output update-rc.d mailinabox defaults
# Set time zone to something convenient for the user # Remove old files we no longer use.
# Backup will be set for 3am localtime so choice is important depending rm -f /etc/cron.daily/mailinabox-backup
# on user locations. 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. cat > /etc/cron.d/mailinabox-nightly << EOF;
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
# Mail-in-a-Box --- Do not edit / will be overwritten on update. # Mail-in-a-Box --- Do not edit / will be overwritten on update.
# Run status checks. # Run nightly tasks: backup, status checks.
$(pwd)/management/status_checks.py --show-changes --smtp 0 3 * * * root (cd `pwd` && management/daily_tasks.sh)
EOF EOF
chmod +x /etc/cron.daily/mailinabox-statuschecks
# Start it. # Start it.
restart_service mailinabox restart_service mailinabox
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment