s3cmd run on command line not on cron

Solution 1:

I had the same problem. In my case it was missing configuration file (different env variables):

s3cmd -c /root/.s3cfg --no-progress -v put $TODAY_FILE $BUCKET  2>&1

If you will invoke your command like:

s3cmd command options 2>&1 | logger

You should be able to see in the logs real problem.

Solution 2:

What worked for me was to make sure HOME is set to the correct path. If you can run the command under user joe then your script should look like this:

HOME=/home/joe
s3cmd ...

Solution 3:

Change

s3cmd put file s3://bucket

to

s3cmd put file s3://bucket > /tmp/s3cmd.log

That way you can see what kind of problem s3cmd is having.

Solution 4:

Make sure you are referencing s3cmd using its full path (/usr/bin/s3cmd) in your script. Check that you have run s3cmd --configure as the user that cron will be running under, generally root.