Cron – s3cmd run on command line not on cron

amazon s3cron

Many have said that the problem is with environment but I still can't seem to solve this problem.
BTW I am using Ubuntu 9.10
login as user, then sudo -s
using this command: s3cmd put file s3://bucket >>worked!
now here is the simple script intended for testing:

#! /bin/bash
env >/tmp/cronjob.log

s3cmd put file s3://bucket

issuing the command crontab -e

* * * * * /opt/script  2>&1 | logger

Then using tail to syslogs

Dec 3 23:22:01 ubuntu CRON[10795]: (root) CMD (/opt/script 2>&1 | logger)

But by verifying it on s3Fox Organizer, the file is not uploaded.

(I tried changing the #! /bin/sh (no effect), putting crons on /etc/crontab (no effect), setting HOME=/home/user (no effect)

What are other options to try? Or other ways to debug this problem.

Thanks

Best Answer

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.