What better topic for my first question here than cron!
I'm having trouble running aws s3 sync as a cron job (on Ubuntu 16.04). Here's what I am able to do:
Manually run the script in the /etc/cron.hourly directory using sudo (so it doesn't seem to be a problem with passing environment values)
Manually run the script in a user directory without sudo
Add either the script or the command itself to /etc/crontab - using either one of these:
23 myusername aws s3 sync /home/myusername/temp/ s3://manning2323
/1 * myusername /home/dbclinton/myusername/temp/s3script.sh
The problem with /etc/crontab, of course, is that it's liable to be overwritten by updates, so it's not good enough for my purposes.
Now here's what doesn't work:
- Leaving the script in cron.hourly and waiting for it to run automatically. It does run (as syslog and journalctl report), but the AWS CLI isn't providing me with any output that I can see so I have no way of knowing why the sync isn't happening. How do I know the sync isn't happening? Because new files aren't showing up in my S3 bucket.
I get exactly the same result with my own crontab adding this line through crontab -e
47 18 * * * /home/myusername/temp/s3script.sh >> /home/myusername/cronlog.txt