diff options
Diffstat (limited to 's3mount.in')
-rw-r--r-- | s3mount.in | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/s3mount.in b/s3mount.in new file mode 100644 index 0000000..c6e5083 --- /dev/null +++ b/s3mount.in @@ -0,0 +1,37 @@ +#! /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 |