Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run my php code in every X minute?

Tags:

ajax

php

i try to make a "status monitor" for our small network. After the page was load i make a ping for every IP which i addedd. Its, ok. But i would like to do this ping in every X minute, without reload my hole page.

I can make it if i reload the page with header refresh, but i would like to do this witout reload.

I think i have to do this with AJAX?, But i dont know how..

Thank you

like image 881
Holian Avatar asked May 19 '10 11:05

Holian


2 Answers

I would strongly suggest you have a look at Nagios or something similar:

1) you don't need to have a web page constantly open to detect problems

2) it can automatically verify and escalate issues

3) there are lots of probes available out of the box which can be used to measure all sorts of things - not just ping times

4) responding to a ping is not the same thing as working

5) it automatically collates stats to identify patterns of issues

6) it also provides SLA type reporting

7) Nagios is simple enough that even I can understand it

8) its what I chose after a lot of work researching a replacement for a system similar to you are suggesting.

HTH

C.

like image 168
symcbean Avatar answered Oct 02 '22 17:10

symcbean


If it is entire code of page i suggest setting up a cron job

and if you want to use ajax ( ie jquery ajax there is a plugin called jquery timer) use it send a ajax request to the page with code you want to run.

http://plugins.jquery.com/project/timers check this out

like image 21
Starx Avatar answered Oct 02 '22 17:10

Starx