Results 1 to 2 of 2
I have very basic info about Linux. I'm using Linux server 11.04 . I'm using the server as a web server to send SMS messages. I have a php page: ...
- 07-05-2011 #1Just Joined!
- Join Date
- Jul 2011
- Posts
- 5
how to Execute PHP file every 10 seconds ?
I have very basic info about Linux. I'm using Linux server 11.04 . I'm using the server as a web server to send SMS messages. I have a php page: read data from mysql and then send SMS (according to retrieved data) , this page is already done and store in www dir. I want this page is execute in the background each 10 sec. is that possible in crontab?
- 08-23-2011 #2
Crontab doesn't have the ability to run every 10 seconds.
What you could do, however, is have 6 scripts, that have a sleep function in them, and set them ALL to run at the same time.
So you have like:
* * * * * file.php
* * * * * file10.php
* * * * * file20.php
then at the top of file10.php use: sleep(10); to make that file wait 10 seconds before doing anything.
Repeat the process for file20 sleep for 20, and file30 file40 etc.
You could do similar by having a function to run your stuff and calling the function, then sleep then the function again, but this will likely cause things to run multiple times, and the safer way would be to run seperate files."I am not an alcoholic, alcoholics go to meetings"
Registered Linux user = #372327


Reply With Quote