aws s3 works with script but not on cron

Posted by user3800017 on Server Fault See other posts from Server Fault or by user3800017
Published on 2014-08-18T21:10:52Z Indexed on 2014/08/18 22:23 UTC
Read the original article Hit count: 242

Filed under:
|

guys.. My first post ! hope not the last ..

I have few bunch of servers on aws ec2 platforms. I made a simple script to backup my custom logs on their s3 storage bucket.

The problem is the script works fine .. but I tried to add it to the crontab. And the script executes but not the s3 sync/mv part !

Here is my code:

NOW=$(date "+%b_%d_%Y")
MY_HOSTNAME=`uname -n`
mv /opt/req/req* /opt/req/bkup/
mv /opt/response/res* /opt/req/bkup/

cd /opt/req/bkup/

tar -cvf ${MY_HOSTNAME}_req_bkup_${NOW}.tar re*

rm *.txt

aws s3 mv /opt/req/bkup/* s3://req

`

© Server Fault or respective owner

Related posts about amazon-web-services

Related posts about cron