merge of '3d21b0780b7affb529a020d89dcbf84325264c7d'
and 'bae1be96df24577937ad8ca98b57c4533df5f763' Monotone-Parent: 3d21b0780b7affb529a020d89dcbf84325264c7d Monotone-Parent: bae1be96df24577937ad8ca98b57c4533df5f763 Monotone-Revision: 46315e3df3a804021e11c1adbe9642bbb8807c09 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-03-02T20:58:03 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
commit
d3b691ff42
|
@ -29,6 +29,12 @@
|
|||
name, based on new property names. Added all new clashing
|
||||
properties to bannedProps.
|
||||
|
||||
2012-03-02 Jean Raby <jraby@inverse.ca>
|
||||
|
||||
* Scripts/sogo-backup.sh: new script to automate backups.
|
||||
Updated sogo.cron to include a commented out entry for sogo-backup.sh
|
||||
Include updates.php in the packages
|
||||
|
||||
2012-03-01 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/LDAPSource.m (_convertRecordToLDAPAttributes):
|
||||
|
|
67
Scripts/sogo-backup.sh
Executable file
67
Scripts/sogo-backup.sh
Executable file
|
@ -0,0 +1,67 @@
|
|||
#!/bin/bash
|
||||
set -o pipefail
|
||||
|
||||
set -x
|
||||
PROGNAME="$(basename $0)"
|
||||
|
||||
BACKUP_DIR=/home/sogo/backups
|
||||
SOGO_TOOL=/usr/sbin/sogo-tool
|
||||
DAYS_TO_KEEP="30"
|
||||
|
||||
DATE=$(date +%F_%H%M)
|
||||
LOG="logger -t $PROGNAME -p daemon.info"
|
||||
|
||||
# log to stdout if on a tty
|
||||
tty -s && LOG="cat -"
|
||||
|
||||
function initChecks {
|
||||
if [ ! -d "$BACKUP_DIR" ]; then
|
||||
mkdir -m700 -p "$BACKUP_DIR"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "BACKUP_DIR doesn't exist and couldn't create it, aborting ($BACKUP_DIR)" | $LOG
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -w "$BACKUP_DIR" ]; then
|
||||
echo "$BACKUP_DIR not writable. Aborting" | $LOG
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function removeOldBackups {
|
||||
|
||||
if [ ! -z $DRYRUN ]; then
|
||||
RM="echo \"not deleted\""
|
||||
else
|
||||
RM="rm -rf"
|
||||
fi
|
||||
|
||||
echo "Deleting old backups..." | $LOG
|
||||
find ${BACKUP_DIR}/ -maxdepth 1 -type d -iname "sogo-*" -mtime "+$DAYS_TO_KEEP" -ls -exec $RM {} \; 2>&1 | $LOG
|
||||
echo "Done deleting old backups." | $LOG
|
||||
}
|
||||
|
||||
|
||||
function dumpit {
|
||||
mkdir -m700 "$BACKUP_DIR/sogo-${DATE}" 2>&1 | $LOG
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
$SOGO_TOOL backup "$BACKUP_DIR/sogo-${DATE}/" ALL 2>&1 | $LOG
|
||||
RC=$?
|
||||
if [ $RC -ne 0 ]; then
|
||||
echo -e "FAILED, error while dumping sogo data" | $LOG
|
||||
exit $RC
|
||||
else
|
||||
echo -e "OK: dumped sogo data" | $LOG
|
||||
fi
|
||||
}
|
||||
|
||||
echo "$PROGNAME starting" | $LOG
|
||||
initChecks
|
||||
dumpit
|
||||
removeOldBackups
|
||||
echo "$PROGNAME exiting" | $LOG
|
||||
|
||||
|
|
@ -6,3 +6,10 @@
|
|||
|
||||
# Email alarms - runs every minutes
|
||||
#* * * * * sogo /usr/sbin/sogo-ealarms-notify
|
||||
|
||||
# Daily backups
|
||||
# - writes to /home/sogo/backups/ by default
|
||||
# - will keep 31 days worth of backups by default
|
||||
# - runs once a day by default, but can run more frequently
|
||||
# - make sure to set the path to sogo-backup.sh correctly
|
||||
#30 0 * * * sogo /usr/share/doc/sogo/sogo-backups.sh
|
||||
|
|
4
debian/sogo.docs
vendored
4
debian/sogo.docs
vendored
|
@ -5,4 +5,6 @@ Scripts/sql-update-1.2.2_to_1.3.0-mysql.sh
|
|||
Scripts/sql-update-1.3.3_to_1.3.4.sh
|
||||
Scripts/sql-update-1.3.3_to_1.3.4-mysql.sh
|
||||
Scripts/sql-update-1.3.11_to_1.3.12.sh
|
||||
Scripts/sql-update-1.3.11_to_1.3.12-mysql.sh
|
||||
Scripts/sql-update-1.3.11_to_1.3.12-mysql.sh
|
||||
Scripts/sogo-backup.sh
|
||||
Scripts/updates.php
|
||||
|
|
|
@ -234,7 +234,7 @@ rm -fr ${RPM_BUILD_ROOT}
|
|||
%config(noreplace) %{_sysconfdir}/cron.d/sogo
|
||||
%config(noreplace) %{_sysconfdir}/httpd/conf.d/SOGo.conf
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/sogo
|
||||
%doc ChangeLog NEWS Scripts/sql*sh
|
||||
%doc ChangeLog NEWS Scripts/*sh Scripts/updates.php
|
||||
|
||||
%files -n sogo-tool
|
||||
%{_sbindir}/sogo-tool
|
||||
|
|
Loading…
Reference in a new issue