#!/bin/sh if [ ! -n "$SWIFT_CONTAINER" ]; then echo Set SWIFT_CONTAINER exit 1; fi path=$1; shift if [ -n "$path" ]; then compressed="${path}.lzo" swift stat $SWIFT_CONTAINER $compressed 2>/dev/null if [ ! $? -eq 0 ]; then lzop -c $path > $compressed swift upload $SWIFT_CONTAINER $compressed rm $compressed else echo "File $compressed already exists in $SWIFT_CONTAINER" exit 1 fi else exit 1 fi