rendered paste body#!/bin/zshif [[ $EUID -ne 0 ]]; then echo "This script must be run as root" 1>&2 exit 1fiS3="/Users/zee/Stuff/s3sync"CONFIGS=("zee-home" "zee-home-1")ACTIVE=""CURRENT=""for i in {1..$#CONFIGS}do ($S3/s3cmd.rb -s list technocore:$CONFIGS[$i]/.active | grep .active) > /dev/null 2>&1 if [[ $? -eq 0 ]]; then ACTIVE=$CONFIGS[$i] CURRENT=$CONFIGS[$(( $i % $#CONFIGS + 1 ))] break fidoneif [[ ( $ACTIVE == "" ) || ( $CURRENT == "" ) ]]; then echo "Couldn't find active backup, something's wrong." 1>&2 exit 1fiecho "Currently active backup: $ACTIVE, backing up to $CURRENT"$S3/s3sync.rb -s --progress -r /Volumes/Backup/Backups.backupdb/discordia/Latest/discordia/Users/zee/zee.sparsebundle technocore:$CURRENT && $S3/s3cmd.rb -s put technocore:$CURRENT/.active /dev/null && $S3/s3cmd.rb -s delete technocore:$ACTIVE/.active