ibanezz
ibanezz

Reputation: 95

Run a url through cronjob

I need to run http://civicrm.example.org/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=username&pass=password&key=site-key through a web browser, so that the email will be sent from the server.
I need to know if there is a way to configure a cron job that does this every 5 or 1 second.

I am using Drupa 7.7 with CiviCRM on a Linux machine.

Upvotes: 1

Views: 474

Answers (2)

T'Saavik
T'Saavik

Reputation: 175

You can do the following 'hackish' thing to achieve this in cron

* * * * * root /usr/bin/wget --quiet --delete-after http://your.url
* * * * * root (sleep 10;/usr/bin/wget --quiet --delete-after http://your.url)
* * * * * root (sleep 20;/usr/bin/wget --quiet --delete-after http://your.url)
* * * * * root (sleep 30;/usr/bin/wget --quiet --delete-after http://your.url)
* * * * * root (sleep 40;/usr/bin/wget --quiet --delete-after http://your.url)
* * * * * root (sleep 50;/usr/bin/wget --quiet --delete-after http://your.url)

It would be better to just run a 'daemon' to do this for you, here is a simple one in bash.

#!/bin/bash
while true;do
   sleep 5
   wget --quiet -O/dev/null "www.example.org"
done

Just fire that up in the background.

Upvotes: 0

Emre Yazici
Emre Yazici

Reputation: 10174

The minimum timeframe in cron is 1 minute, most cron daemons check every 30 seconds to see if anything needs to be done. You cannot use second timeframe with cron. However this will fetch the URL every minute:

* * * * * root /usr/bin/wget --quiet --delete-after http://your.url

Upvotes: 4

Related Questions