Hi,
My s3sync script to back up a folder to S3 works fine when I run it from command prompt, But when I use the same script in the cron job, it fails
Script:
#!/bin/bash
# script to upload local directory upto s3
export AWS_ACCESS_KEY_ID=vvv
export AWS_SECRET_ACCESS_KEY=vvv
export AWS_CALLING_FORMAT=REGULAR
export SSL_CERT_DIR=vvv
date_time=$(date)
check="1"
NUM_BUCKETS=$(/usr/bin/ruby s3cmd.rb list hellobucket:$hostname | wc -l)
NAME=$(hostname)
if [ $NUM_BUCKETS != $check ]
then
echo "$date_time:Bucket exists. Syncing the files!"
/usr/bin/ruby /root/s3sync/s3sync.rb -r --ssl --delete --debug /var/log/ hellobucket:$NAME
else
echo "$date_time : Creating new bucket"
/usr/bin/ruby s3cmd.rb createbucket hellobucket:$NAME
echo "$date_time : Syncing the files!"
/usr/bin/ruby /root/s3sync/s3sync.rb -r --ssl --delete --debug /var/log/ hellobucket:$NAME
fi
------------
s3sync cron:
*/5 * * * * /root/s3sync/./updatesync.sh >> /root/s3sync.log