Sync not working on cron schedule

jasbur
2011-04-09
2013-02-19
  •  jasbur
    jasbur
    2011-04-09

    I have a bash script at /etc/cron.hourly/hourlybackup

    1
    2
    3
    #!/bin/bash
    /root/s3cmd-1.0.0/s3cmd sync /var/flexshare/shares s3://[s3 bucket]/backup/
    /root/s3cmd-1.0.0/s3cmd sync /home s3://[s3 bucket]/backup/
    

    But after waiting it never seems to trigger. However, if I execute the script manually everything works great. I have a feeling this might be more of a cron issue than s3cmd, but I can't seem to spot it. What am I missing?

     
  • Michal Ludvig
    Michal Ludvig
    2011-04-10

    Hi

    You may need to give it an explicit path to a config file:
    s3cmd -config /root/.s3cfg sync …
    The runtime environment is a little different when running from cron than on the console and s3cmd may in some cases be unable to find the config file automatically.

    Michal

     
  •  jasbur
    jasbur
    2011-04-12

    That was it! Thanks a million. I just added

    --config /root/.s3cfg
    

    to the command and it works great.