A
A
Alex552017-08-13 20:42:56
Task Schedulers
Alex55, 2017-08-13 20:42:56

How to run Cron task more than a minute?

Hello. Tell me how to run a php script in CronTab more than once a minute?
Video is the solution:

Run the task every 30 seconds:
*/1 * * * * root /home/mybin/script.sh; /bin/sleep 30; /home/mybin/script.sh

Run the task every 20 seconds:
*/1 * * * * root /home/mybin/script.sh; /bin/sleep 20; /home/mybin/script.sh; /bin/sleep 20; /home/mybin/script.sh

Run the task every 15 seconds:
*/1 * * * * root /home/mybin/script.sh; /bin/sleep 15; /home/mybin/script.sh; /bin/sleep 15; /home/mybin/script.sh; /bin/sleep 15; /home/mybin/script.sh

It is very important to run the script every 15-30 seconds.
How to implement on BeGet.com?
Thank you.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
T
ThunderCat, 2017-08-14
@ThunderCat

Stopudovo is some kind of stupid task that doesn’t require a cron at all, these “secrets” are boring, write normally - “I can’t figure out how to do % certain_functional% correctly, I got the idea to do it wrong, how to do it right?”. No, everyone writes - "my skis do not go on asphalt, tell me how to attach wheels and a rocket engine to them, for which I will not say, this is the Great Secret."

I
ideological, 2017-08-13
@ideological

It's easier to run one script that runs "always" in a loop, and there you can already set a delay in seconds in it, if necessary.

S
Sergey Sokolov, 2017-08-13
@sergiks

Why not just run a long-running task that will check the time and perform the required action at the right moments?
Explain how long this common task takes to complete? Is it always guaranteed to be within 15 seconds? If there is a risk of overlapping adjacent executions due to the first one taking too long, you will need somewhere to store the time of the previous run and the “running right now” / “free” status flag.

L
Leonid Smirnov, 2019-04-02
@SunyJun

Here is a solution, just for Beget - https://www.pandoge.com/stati_i_sovety/zapusk-zada...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question