Wednesday, January 27, 2010

Pulmonary Fibrosis Life Expectancy Symptoms

UNICAL_INFO - Run PHP script at regular intervals of time not















Run PHP script at regular intervals

Date: Wednesday, July 31 @ 17:44:47 EDT

Topic:
WebProject



Running PHP scripts as cronjobs


(...)
dilema The first depends on your PHP installation
:



  • Compiled CGI
  • Apache module

Compiled CGI
In the first case you'll have to
add a line to your script. It must the first line of your
script and must contain PHP executable location:


#!/usr/local/bin/php -q


After that let's add the necessary command to our
crontab. Edit /etc/crontab (or wherever your crontab file is)
and add the following line:


* * * * *
php /path/to/your/cron.php


execute the following from the command line:


Shell>
crontab crontab


Be
sure cron.php has the necessary permissions to be
executable.


Apache module

If you have PHP
installed as an Apache module the approach is quite
different.

First of
all you need access to lynx (read here for
more information).
You PHP script does not need additional
lines in this case. You simply have to edit your /etc/crontab
file and add the following line:


* * * * *
lynx -dump http://www.somedomain.com/cron.php


Note you generally have to specify the compete URL:
depending on your lynx configuration the URL should be
But I always suggest its use to the absolute reference
like in the example above, since it always works.


Again execute
The following from the command line:


Shell> crontab crontab

(...)



in practice we have applied the so
, using,

telnet / usr / bin / crontab-e
for the execute every 5 minutes,
a php file

################################################## #############
MAILTO = ""
* / 5
* * * * lynx-dump
http://dominio/path_del_file/file.php
####### ################################################## ######
with
MAILTO = "" not to receive an email every five minutes with
dump file generated by php


What Does Our php file?



  • check your email to reporter@elinux.economia.unical.it

  • for each new message

    • if there is an attachment

      • decodes
      • saves in a folder
      • add a record to the MySQL database for the portal
        write a new article with the data from the message

      • delete the message processed

    • if there is an attachment

      • delete the message








This article comes from UNICAL.INFO
http://elinux.economia.unical.it/


The URL for this story:
http://elinux.economia.unical .com / modules.php? name = News & file = article & sid = 118

0 comments:

Post a Comment