> This unfortunately will not work, simply because when you export your key, you are setting them for a shell environment.
> Cronjobs run without any shell environment per-say, which is also why you need to fully qualify the path of your ruby installation.
I beg to differ. I am running s3sync-scripts since years directly from crontab in exactly the way svittal suggests. I wouldn't go so far to say that cronjobs have exactly the same environment than normal users, but it is certainly sufficient to set the appropriate environment variables to get s3sync to work. There is no need for any .yml-file (which has been introduced to s3sync at a later development stage, when people already were happily syncing with crontab). And you don't have to use the fully qualified path to the ruby installation either, if the path variable is properly set as well.
That brings us back to svittals problem. Which might be solved by setting the path the way it's done for the user.
Thats how my crontab-environment looks without doing anything to it:
MAILTO=logs@br...com
SHELL=/bin/sh
USER=maelcum
PATH=/usr/bin:/bin
_=/usr/bin/printenv
PWD=/Users/maelcum
HOME=/Users/maelcum
SHLVL=2
LOGNAME=maelcum
This is what it looks like in my scripts. I am using an ruby- and s3sync-installation in the /opt-directory, so have added that to the PATH-variable. Done.
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
export SSL_CERT_FILE=/opt/bin/s3sync/ca-certificates.crt
export S3SYNC_NATIVE_CHARSET=UTF-8
export PATH=/opt/bin:/opt/bin/s3sync:/opt/sbin:$PATH
Probably the easiest way to find out whats missing is making a cronjob that does nothing but "printenv >some_filename_where_the_output_should_go". By comparing this output and the results that printenv gives as a logged in user, you would know what to add.