Request a webpage with Cron
-
03-07-2019 - |
Question
I have an MVC architecture and since I already have an action that would be extra useful if automatically called every hour or so, I wondered if there's a way to set it up as a cron job?
Solution
You can use
curl http://example.com
Or if the language you're using has a CLI client like PHP you could just run the script like
php /var/www/example.com/index.php
Edit: For an MCV app it's probably easiest to use curl
OTHER TIPS
Don't know how periodic web page request is related to mvc, but you can achieve this by adding following line to crontab (1 hour period):
0 0/1 * * * wget <web_page_url>
Which is translated to: use wget
command to request <web_page_url>
every hour at zero minutes.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow