#! /bin/bash -E

## @id $Id$

##       1         2         3         4         5         6         7         8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890

# call this script as user root with a list of hostnames to backup
# please note, that user root you must have his ssh-key copied to all hosts

HOSTS="$*"
prefix="@prefix@"
exec_prefix="@exec_prefix@"

for period in daily weekly monthly; do
    for h in $HOSTS; do
        if [ -e "@sysconfdir@/cron.$period/backup-${h//./_}" ]; then
            rm "@sysconfdir@/cron.$period/backup-${h//./_}"
        fi
        ln -s "@sbindir@/backup-generic" \
              "@sysconfdir@/cron.$period/backup-${h//./_}";
    done;
done

if [ ! -e "@sysconfdir@/cron.hourly/escalate-backup" ]; then
    ln -s "@sbindir@/escalate-backup" \
          "@sysconfdir@/cron.hourly/escalate-backup"
fi
