W
W
weranda2014-07-14 21:14:56
PHP
weranda, 2014-07-14 21:14:56

How to configure website page refresh every 5 seconds via crontab?

Greetings.
The site has a page that needs to be updated every five seconds. The site is hosted by beget, but there I can only set a minimum interval of one minute. Less I don't know how. Please help with good advice.
This is what the crontab control panel looks like.
o5DkKoPD9QW_QG2_Q5XCCx7AnVcg_qFMctI3PxAWNCKF-q0aPQSHZ65ch7jCmhkwU9xFLxLP8nmtkYgy
Please tell me, as an inexperienced person in this matter, what exactly can be written so that this page is loaded by cron every five seconds. I can only write the command in the hosting control panel.
Maybe there are some alternatives?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Rsa97, 2014-07-14
@Rsa97

Cron will not help you, it has a minute - the minimum interval.
If you only create 12 jobs every minute, each (except the first) with a delay through sleep

wget ...
sleep 5 && wget ...
sleep 10 && wget ...

I
Igor, 2014-07-14
@merryjane

You can wrap it all in a loop without cron and run:
but if this script does not work for you in 5 seconds (for example, the page will be unavailable), then the queue will accumulate.
The same will happen if he twitches from cron.
You can create a large load of the created queue.
Therefore, we need to make a lock-file, that is, before calling, we check that it does not exist (the script worked successfully for the last time interval), if not, then we create and execute our action, when the action is completed, delete it. In this case, if any of the iterations hangs, then thanks to the lock-file, the next one will not start until the previous one is completed.

A
Alexander N++, 2014-07-14
@sanchezzzhak

Edit the crontab file or manually where the path to the file
is. Here for 15 seconds, but you can duplicate the commands for 5 seconds and sleep for an interval of 1 minute.
The first run will be 1 minute, all the rest of the next 15 seconds, then again in a circle.
PS do not use wget use the command for this - php path to the script.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question