fork 0k-charms
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.

39 lines
1016 B

  1. #!/bin/bash
  2. ## REQUIRES: 0k-manage mail
  3. [ -n "${BACKUP_SERVER}" ] || {
  4. echo "Error: you must set \$BACKUP_SERVER prior to running this script." >&2
  5. exit 1
  6. }
  7. if ! [ -e "/etc/default/alerting" ]; then
  8. if [ -z "$DEFAULT_ALERTING_EMAILS" ]; then
  9. echo "You must define \$DEFAULT_ALERTING_EMAILS before launching this script." >&2
  10. exit 1
  11. fi
  12. cat <<EOF > /etc/default/alerting
  13. MAIL_DESTS=(
  14. $(
  15. for email in $DEFAULT_ALERTING_EMAILS; do
  16. echo " $email"
  17. done
  18. )
  19. )
  20. EOF
  21. fi
  22. ln -sfv /opt/apps/0k-manage/src/etc/cron.hourly/check-* /etc/cron.hourly/
  23. if ! [ -e /usr/local/sbin/mirror-dir ]; then
  24. ln -sfv /opt/apps/0k-charms/rsync-backup/resources/bin/mirror-dir /usr/local/sbin/
  25. fi
  26. mailname=$(cat /etc/mailname)
  27. mailname=${mailname%.localdomain}
  28. cat <<EOF > /etc/cron.d/mirror-dir-check
  29. SHELL=/bin/bash
  30. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  31. 35 * * * * root mirror-dir check -d "$BACKUP_SERVER:10023" -n '12 hours' | logger -t mirror-dir-check
  32. EOF