Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


share|improve this question
I also tried this /usr/local/bin/s3cmd put file s3://bucket (still no effect) – Jonar Dec 3 '10 at 15:26


s3cmd put file s3://bucket


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

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

share|improve this answer

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.

share|improve this 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.

share|improve this answer

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:

s3cmd ...
share|improve this answer

cron runs under root user, make sure your root user has s3cmd configuration otherwise copy them for root user

cp -i /home/ubuntu/.s3cfg /root/.s3cfg

share|improve this answer

Check that $HOME/.s3cfg contains the access key and secret code for s3. If not, s3cmd will try to fetch them from the env variables which is different during cron session.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.