diff --git a/precise/host/hooks/install.d/70-0k.sh b/precise/host/hooks/install.d/70-0k.sh index d3723f0b..c2ef19c4 100755 --- a/precise/host/hooks/install.d/70-0k.sh +++ b/precise/host/hooks/install.d/70-0k.sh @@ -225,7 +225,6 @@ rm -rf /var/cache/compose cat < /etc/default/datastore DATASTORE=/srv/datastore -SNAPSHOT_BACKUP=/var/backups/snapshot EOF cat < /etc/default/compose diff --git a/precise/host/hooks/install.d/96-backup-lxc.sh b/precise/host/hooks/install.d/96-backup-lxc.sh index ebf4908b..d912f683 100755 --- a/precise/host/hooks/install.d/96-backup-lxc.sh +++ b/precise/host/hooks/install.d/96-backup-lxc.sh @@ -8,3 +8,73 @@ ln -sf /opt/apps/lxc-scripts/etc/cron.hourly/* /etc/cron.hourly/ ln -sf /opt/apps/lxc-scripts/etc/cron.daily/* /etc/cron.daily/ + + +if ! grep ^BACKUP_LXC_PATH= /etc/default/lxc >/dev/null 2>&1; then + echo "BACKUP_LXC_PATH=/var/backups/lxc" >> /etc/default/lxc +fi + + +if ! grep ^BACKUP_SNAPSHOT_PATH= /etc/default/datastore >/dev/null 2>&1; then + echo "BACKUP_SNAPSHOT_PATH=/var/backups/snapshot" >> /etc/default/datastore +fi + + +## +## Mirror dir's logrotate and rsyslog's entry +## + + +mkdir -p /etc/mirror-dir +cat < /etc/mirror-dir/config.yml +default: + sources: + - /etc + - /opt + - /root + - /var/log + - /var/lib/lxc + - /home + - /boot + - /srv + - /var/backups/lxc/latest + +/var/lib/lxc: + exclude: + - /*/rootfs +EOF + + +cat < /etc/rsyslog.d/mirror-dir.conf + +if \$programname == 'mirror-dir' then { + action(type="omfile" file="/var/log/mirror-dir.log") + stop +} + +EOF + +service rsyslog restart + + +cat < /etc/logrotate.d/mirror-dir.log +/var/log/mirror-dir.log +{ + weekly + missingok + dateext + dateyesterday + dateformat _%Y-%m-%d + extension .log + rotate 52 + compress + delaycompress + notifempty + create 640 root root + sharedscripts + postrotate + reload rsyslog >/dev/null 2>&1 || true + endscript +} + +EOF