You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

40 lines
1016 B

#!/bin/bash
## REQUIRES: 0k-manage mail
[ -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 <<EOF > /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 <<EOF > /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 "$BACKUP_SERVER:10023" -n '12 hours' | logger -t mirror-dir-check
EOF