I have a Digital Ocean Droplet (VPS) running Ubuntu 14.04. I have installed s3cmd and am able to run a sync successfully with this command:
s3cmd sync --recursive --preserve /srv s3://MY-BUCKET-NAME
And if I put that same command in to a .sh to run as a cron-task every minute, it works:
* * * * * sh /srv/backupToS3.sh >> /srv/backupToS3.log
But when I add some echos and dates to the .sh:
echo 'Started:'
date +'%a %b %e %H:%M:%S %Z %Y'
s3cmd sync --recursive --preserve /srv s3://MY-BUCKET-NAME
echo 'Finished:'
date +'%a %b %e %H:%M:%S %Z %Y'
the s3cmd sync does not work/run anymore. But the echos and dates print to the log file:
Started:
Mon Jun 8 17:45:01 PDT 2015
Finished:
Mon Jun 8 17:45:01 PDT 2015
Any help or push in the right direction would be very appreciated. I originally followed this article to get this far.
s3cmd uses a configuration file located at ~/.s3cfg. It's probably having trouble picking that up. Pass in
--config=/home/username/.s3cfg
and see if that helps.In any case, s3cmd isn't consistently maintained. The official commandline client (aws-cli) is much better in many ways.
edit: use this as your .sh file, make sure it has the executable bit set (
chmod 755 whatever.sh
).