diff --git a/precise/host/hooks/install.d/40-btrfs.sh b/precise/host/hooks/install.d/40-btrfs.sh index 2c60782..a33e5a2 100755 --- a/precise/host/hooks/install.d/40-btrfs.sh +++ b/precise/host/hooks/install.d/40-btrfs.sh @@ -54,7 +54,7 @@ if [ "$UPDATE_BTRFS_TOOLS" ]; then zlib1g-dev python3-dev python3-setuptools libacl1-dev e2fslibs-dev \ libblkid-dev liblzo2-dev libzstd-dev /etc/resolv.conf diff --git a/precise/host/hooks/install.d/95-checks.sh b/precise/host/hooks/install.d/95-checks.sh index 4b8bd4c..9830af3 100755 --- a/precise/host/hooks/install.d/95-checks.sh +++ b/precise/host/hooks/install.d/95-checks.sh @@ -2,16 +2,39 @@ ## REQUIRES: 0k-manage mail -ln -sf /opt/apps/0k-manage/src/etc/cron.hourly/check-* /etc/cron.hourly/ - - -ln -sf /opt/apps/0k-charms/rsync-backup/resources/bin/mirror-dir-check /usr/local/sbin/ - - +[ -n "${BACKUP_SERVER}" ] || { + echo "Error: you must set \$BACKUP_SERVER prior to running this script." >&2 + exit 1 +} + +if ! [ -e "/etc/default/alerting" ]; then + if [ -z "$DEFAULT_ALERTING_EMAILS" ]; then + echo "You must define \$DEFAULT_ALERTING_EMAILS before launching this script." >&2 + exit 1 + fi + cat < /etc/default/alerting +MAIL_DESTS=( +$( +for email in $DEFAULT_ALERTING_EMAILS; do +echo " $email" +done +) +) +EOF +fi + +ln -sfv /opt/apps/0k-manage/src/etc/cron.hourly/check-* /etc/cron.hourly/ + +if ! [ -e /usr/local/sbin/mirror-dir ]; then + ln -sfv /opt/apps/0k-charms/rsync-backup/resources/bin/mirror-dir /usr/local/sbin/ +fi + +mailname=$(cat /etc/mailname) +mailname=${mailname%.localdomain} cat < /etc/cron.d/mirror-dir-check SHELL=/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -35 * * * * root mirror-dir-check -d "core-06.0k.io:10023" -n '12 hours' | logger -t mirror-dir-check +35 * * * * root mirror-dir check -d "$BACKUP_SERVER:10023" -n '12 hours' | logger -t mirror-dir-check EOF \ No newline at end of file diff --git a/precise/host/hooks/install.d/96-backup-lxc.sh b/precise/host/hooks/install.d/96-backup-lxc.sh index d912f68..b2dc233 100755 --- a/precise/host/hooks/install.d/96-backup-lxc.sh +++ b/precise/host/hooks/install.d/96-backup-lxc.sh @@ -6,8 +6,8 @@ ## Backup lxc ## -ln -sf /opt/apps/lxc-scripts/etc/cron.hourly/* /etc/cron.hourly/ -ln -sf /opt/apps/lxc-scripts/etc/cron.daily/* /etc/cron.daily/ +ln -sfv /opt/apps/lxc-scripts/etc/cron.hourly/* /etc/cron.hourly/ +ln -sfv /opt/apps/lxc-scripts/etc/cron.daily/* /etc/cron.daily/ if ! grep ^BACKUP_LXC_PATH= /etc/default/lxc >/dev/null 2>&1; then