Search code examples
bashamazon-web-servicescronbitnamis3cmd

Cronjob error - s3cmd - No such file or directory


I am in the process of setting up a wordpress/woocommerce site on AWS with a CloudFront CDN however I am unable to get the cronjob push to S3 working.

I am using the stock bitnami wordpress AMI and have installed s3cmd. Using s3cmd I have been able to transfer (put) files to the S3 bucket successfully however I am unsuccessful in getting the cronjob working.

I am trying to push changes every five mins:

*/5 **** bitnami /usr/share/s3cmd sync -r --delete-removed --add header "Cache-Control:max-age=31536000" /opts/bitnami/apps/wordpress/htdocs/wp-content s3://www.example.com

Which returns:

-bash: */5: No such file or directory

I could be off it seems like I am off in my cron script as the following code is working:

s3cmd put -r --add header "Cache-Control:max-age=31536000" /opts/bitnami/apps/wordpress/htdocs/wp-content s3://www.example.com

I've confirmed that the directories exist and the s3 IAM permissions are valid.


Solution

  • I was able to figure it out with the help of a few people that know their stuff...

    Came down to a missing /

    */5 * * * * /usr/bin/s3cmd sync -r --delete-removed --add-header "Cache-Control:max-age=31536000" /opt/bitnami/apps/wordpress/htdocs/wp-content/ s3://www.example.com/