7
7
7vVFjkCFENfu2020-02-11 13:42:37
ubuntu
7vVFjkCFENfu, 2020-02-11 13:42:37

In what order are tasks scheduled at the same time executed in Cron?

Hello.

There is a weak VPS on Ubuntu server (1 core, 1GB RAM) It is

required to execute a .py file every minute (a Cron task is configured for this). New requirements have appeared: now you need to execute 5 of the same files every minute, only with slightly changed values.

Actually the question is:
If you create five of the same tasks in Cron for each file separately, will they all be executed simultaneously (which can overload the machine) or in some order (in turn)?

Can they be separated? For example, so that they are executed with an interval of 10 seconds?

If Cron is not suitable for this, please advise an alternative way, thanks.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
W
Wexter, 2020-02-11
@7vVFjkCFENfu

Can they be separated? For example, so that they are executed with an interval of 10 seconds?

Write a script that calls your script with different parameters in turn
#!/bin/bash
python script.py
sleep 10
python script.py
....

throw the script in cron at the right time

C
CityCat4, 2020-02-11
@CityCat4

Do not pull the cron, but start a demon that will start the necessary scripts itself at the required interval, at least every second.

P
Puma Thailand, 2020-02-15
@opium

At the same time
Before each task, write sleep and the desired delay

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question