#! /bin/bash set -e test -z "$BACKUP_CONFIG" && BACKUP_CONFIG=@SYSCONFDIR@/backup.conf if [ ! -r $BACKUP_CONFIG ]; then echo >&2 "$0: configuration file $BACKUP_CONFIG is not found or is unreadable" exit 1 fi . @LIBDIR@/backup/common.sh . $BACKUP_CONFIG . @LIBDIR@/backup/s3.sh if [ -z "$backup_bucket_name" ]; then echo >&2 "$0: backup_bucket_name is not defined (examine $BACKUP_CONFIG)" exit 1 fi case $1 in start) s3_mount echo "$backup_bucket_name mounted under $backup_mp_s3";; stop) s3_unmount;; status) for id in s3 backer do mpoint=$(s3_getmpoint $id) if [ -n "$mpoint" ]; then echo "$id is mounted on $mpoint" fi done;; *) echo "$0 mounts or unmounts a backup s3 bucket, as configured in $BACKUP_CONFIG" echo "usage: $0 start|stop" esac