2

First upon this is my first question. By using Cronjob I want to open 4 URL every day at 10 am as per Indian time. How can I do this?

Below is given a list of URL.

http://www.pragnaprinters.com/Pragna/index.php/Notification/todays_ad

http://www.pragnaprinters.com/Pragna/index.php/Notification/custom_notification

http://www.pragnaprinters.com/Pragna/index.php/Notification/payment_notification

http://www.pragnaprinters.com/Pragna/index.php/Notification/todays_birth

1 Answers1

4
0 10 * * * curl -s "http://www.pragnaprinters.com/Pragna/index.php/Notification/todays_ad" > /dev/null
0 10 * * * curl -s "url 2..." > /dev/null

This will run curl, fetching only the URL's. It'll ignore redirects and all media on page. It'll be executed at 10:00.

You can add entries to crontab using the command crontab -e, further described in this question.

If curl is not installed, you can install it with sudo apt-get install curl

Curl is also highly customizable and scriptable. man curl will give you a overview of this. In the above example -s is used to make curl silent, so no output is produced.

You can also add the curl commands in a file, like this:

#!/bin/bash
curl -s "url 1" > /dev/null
curl -s "url 2" > /dev/null

save the file as for instance /home/username/bin/curlscript.sh, and run chmod +x curlscript.sh. This can then be used in cron, instead of listing each command.

vidarlo
  • 22,691