aws s3 works with script but not on cron
- by user3800017
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
`