All pastes #917365 Raw Edit

Stuff

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