Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I work with sceduled tasks?

Status
Not open for further replies.

joostschouten

Programmer
Jun 28, 2002
3
NL
Hi,

I am a JAVA programmer and wish to build a small PHP tool which will check the status of my java application.

I would like to know if PHP can execute scripts on the server without a request being made. In JAVA I can start executing my code upon server startup and loop through my code once every n seconds. Is this possible in PHP, and if so, does anyone have a simple example?

Kind regards and I look forward to your reply,
Joost Schouten
with
 
yes it can. just call "php.exe /path/to/script/scriptname.php"

in windows you use task scheduler (control panel on desktop boxes) to do this. in *nix establish a chron job

 
if you are un *nix environment you create the script as follow:


#!/where_is/php

echo "Code begins here..";

..

_______-
then chmod +x script.php and put it in cron job.

cheers
 
Thanks guys, that will do the trick for me! I love the prompt replies here!

Have a great day,
Joost
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top