Commit 4305a719 authored by Joshua Tauberer's avatar Joshua Tauberer

merge #587 - move backup and nightly status checks to 3am in system time

previously these were run in a cron.daily script which per crontab is run at 6:25 am local time
parents 3cb5e109 a4d8e12f
...@@ -20,6 +20,7 @@ Control panel: ...@@ -20,6 +20,7 @@ Control panel:
System: System:
* Nightly backups and system status checks are now moved to 3am in the system's timezone.
* fail2ban's recidive jail is now active, which guards against persistent brute force login attacks over long periods of time. * fail2ban's recidive jail is now active, which guards against persistent brute force login attacks over long periods of time.
* Setup (first run only) now asks for your timezone to set the system time. * Setup (first run only) now asks for your timezone to set the system time.
* The Exchange/ActiveSync server is now taken offline during nightly backups (along with SMTP and IMAP). * The Exchange/ActiveSync server is now taken offline during nightly backups (along with SMTP and IMAP).
...@@ -31,6 +32,7 @@ System: ...@@ -31,6 +32,7 @@ System:
* Fix pip command that might have not installed all necessary Python packages. * Fix pip command that might have not installed all necessary Python packages.
* The control panel and backup would not work on Google Compute Engine because GCE installs a conflicting boto package. * The control panel and backup would not work on Google Compute Engine because GCE installs a conflicting boto package.
* Added a new command `management/backup.py --restore` to restore files from a backup to a target directory (command line arguments are passed to `duplicity restore`). * Added a new command `management/backup.py --restore` to restore files from a backup to a target directory (command line arguments are passed to `duplicity restore`).
* Update Roundcube to version 1.1.3.
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
...@@ -31,25 +31,18 @@ rm -f /etc/init.d/mailinabox ...@@ -31,25 +31,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
# Perform a daily backup. # Remove old files we no longer use.
cat > /etc/cron.daily/mailinabox-backup << EOF; rm -f /etc/cron.daily/mailinabox-backup
#!/bin/bash rm -f /etc/cron.daily/mailinabox-statuschecks
# Mail-in-a-Box --- Do not edit / will be overwritten on update.
# Perform a backup.
$(pwd)/management/backup.py
EOF
chmod +x /etc/cron.daily/mailinabox-backup
# Perform daily status checks. Compare each day to the previous # Perform nightly tasks at 3am in system time: take a backup, run
# for changes and mail the changes to the administrator. # status checks and email the administrator any changes.
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. # 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