I’ve written a script to get the size of my S3 storage, the script works fine barring the fact that it keeps looping and never ends. I get all the outputs as I need but it keeps going through them.
Any ideas on why its looping?
#!/bin/sh
DAY=$(date +"%d%b%Y")
BUCKET='/home/user/Scripts/Holding/s3buckets.txt'
BLIST='/home/user/Scripts/Holding/blist.txt'
LOGDIR='/home/user/Scripts/Holding/'
USAGE=$BLIST
s3cmd ls > $BUCKET
awk '{print $3}' $BUCKET > $BLIST
while read USAGE; do
s3cmd du -H $USAGE
done < $BUCKET > $LOGDIR/S3Usage$DAY.txt
Change
s3cmd du -H $USAGEtos3cmd du -H s3://$USAGEWithout the
s3://, s3cmd defaults to giving the listing for all buckets. I’m betting thats3buckets.txtjust has the bucket names, not the protocol prefix.