#!/bin/bash

## When writing relation script, remember:
##  - they should be idempotents
##  - they can be launched while the dockers is already up
##  - they are launched from the host
##  - the target of the link is launched first, and get a chance to ``relation-set``
##  - both side of the scripts get to use ``relation-get``.

. lib/common

set -e

## if I'm not linked to a schedule-command, then complain
if read-0 ts _ _ < <(get_service_relation "$SERVICE_NAME" "schedule-command"); then
    debug "schedule-command relation fullfilled"
else
    ## XXXvlab: relation dependence as this one could actually be implemented in compose-core
    err "backup relation requires schedule-command relation to be set"
    exit 1
fi