开发者

Run a url through cronjob

开发者 https://www.devze.com 2023-03-24 04:52 出处:网络
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

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 Drup开发者_StackOverflow中文版a 7.7 with CiviCRM on a Linux machine.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消