Issue
I had come across another post where one guy talked about how he has his web server downloading a JS file from AWS on a routine basis using a cron job. I haven't created a cron job before, but his routine is exactly what I need to implement.
I found out that my web host doesn't allow wget commands in cron jobs and they recommended that I use cURL instead. Here's what I've got so far, but it doesn't seem to be working:
/usr/bin/curl --user-agent cPanel-Cron https://s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js --output wp-content/uploads/libraries/wp-content/uploads/libraries
Their documentation states that you need to declare a user agent (doesn't matter what it is) so that's why that's in there.
In a nutshell, I want it to download this file into that specific folder, keep the same file name, and overwrite the one that's already in there.
Am I even close?
Solution
use wget instead:
wget -O /virtualhosts/some-directory/wp-content/uploads/libraries/wp-content/uploads/libraries/mc-validate.js https://s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js
EDIT: Since your host doesn't support wget
and does support curl
you can use the curl exactly as you've posted, however for a cron job you'll likely want an absolute path to the file location:
curl --user-agent cPanel-Cron https://s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js --output /absolute/path/to/mc-validate.js
^^ note: these are just fake absolute paths. You can run pwd
from a shell to determine the actual absolute path to wp-content/uploads/libraries/wp-content/uploads/libraries
.
Answered By - Dave Maple Answer Checked By - Terry (WPSolving Volunteer)