简体   繁体   中英

bash & s3cmd not working properly

Hi I have a shell script which contains s3cmd command on ubuntu 12.04 LTS. I configured cron for this shell script which works fine for local environment but don't push the file to s3. But when i run shell script manually, It pushes the file to s3 without any error. I checked log and found nothing for this. Here is my shell script.

#!/bin/bash
User="abc"
datab="abc_xyz"
pass="abc@123"
Host="abc1db.instance.com"
FILE="abc_rds`date +%d_%b_%Y`.tar.gz"
S3_BKP_PATH="s3://abc/db/"

cd /abc/xyz/scripts/

mysqldump -u $User $datab -h $Host -p$pass | gzip -c > $FILE | tee -a /abc/xyz/logs/app-bkp.log

s3cmd --recursive put /abc/xyz/scripts/$FILE  $S3_BKP_PATH | tee -a /abc/xyz/logs/app-bkp.log

mv /abc/xyz/scripts/$FILE /abc/xyz/backup2015/Database/

#END

This is really weird. Any suggestion would be a great help.

Check if the user running configured in crontab has correct permissions and keys in the environment.

I am guessing the keys are configured in env file as they are not here in the script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM