Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

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
add comment

4 Answers 4

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.

share|improve this answer
add comment

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
add comment

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

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
add comment

Your Answer

 
discard

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.