TransWikia.com

S3 command not working in cron

Super User Asked by kargirwar on December 31, 2020

I have this ultra simple cron job:

48 20 * * * cd /home/pankaj;s3cmd -f get s3://myfile.gz

The command works by itself. But the cron job does not. The cron job
is created for the same user(pankaj) who is able to run the command.
There is not much information in /var/log/syslog either.

Oct 15 20:48:01 dev CRON[17020]: (pankaj) CMD (cd /home/pankaj;s3cmd -f get s3://myfile.gz)
Oct 15 20:48:01 dev CRON[17019]: (CRON) info (No MTA installed, discarding output)

How can I find out what is going wrong?
The permissions of .s3cfg are like these:

pankaj@dev:~$ ls -l .s3cfg 
-rw------- 1 pankaj pankaj 2050 Feb  7  2018 .s3cfg

One Answer

Modified the cronjob to this:

48 20 * * * cd /home/pankaj;s3cmd -f get s3://myfile.gz 2>&1 | tee log

And log showed this:

s3cmd: command not found

:(. So a simple change solved the problem:

48 20 * * * cd /home/pankaj;/usr/local/bin/s3cmd -f get s3://myfile.gz

Answered by kargirwar on December 31, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP