clean up the backup time patch: dont choose timezone here, move status checks into the same 3am script
This commit is contained in:
parent
8a35905d2e
commit
a4d8e12fd7
3 changed files with 17 additions and 23 deletions
|
@ -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)
|
||||||
------------------------
|
------------------------
|
||||||
|
|
8
management/daily_tasks.sh
Executable file
8
management/daily_tasks.sh
Executable 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
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue