Issue
At the moment i run 7 scripts at the same time via cronjob.
This is how my crontab-file looks like:
0 */2 * * * python3 /my/path/script1.py > /my/path/cronlog.txt
0 */2 * * * python3 /my/path/script2.py > /my/path/cronlog.txt
0 */2 * * * python3 /my/path/script3.py > /my/path/cronlog.txt
0 */2 * * * python3 /my/path/script4.py > /my/path/cronlog.txt
0 */2 * * * python3 /my/path/script5.py > /my/path/cronlog.txt
0 */2 * * * python3 /my/path/script6.py > /my/path/cronlog.txt
0 */2 * * * python3 /my/path/script7.py > /my/path/cronlog.txt
Now the problem is they are running at EXAKT the same time. But i need a delay of more or less 30 seconds between each cron.
Is it possible to build something like /etc/cron.hourly
would do? I don't mind if script1.py runs at exakt 2pm or 2.30pm. It is only necessary to run it every 2 hours.
Solution
Instead of running all of them at 0 minutes, you could run them at different minutes?
0 */2 * * * python3 /my/path/script1.py > /my/path/cronlog.txt
1 */2 * * * python3 /my/path/script2.py > /my/path/cronlog.txt
2 */2 * * * python3 /my/path/script3.py > /my/path/cronlog.txt
3 */2 * * * python3 /my/path/script4.py > /my/path/cronlog.txt
4 */2 * * * python3 /my/path/script5.py > /my/path/cronlog.txt
5 */2 * * * python3 /my/path/script6.py > /my/path/cronlog.txt
6 */2 * * * python3 /my/path/script7.py > /my/path/cronlog.txt
Answered By - Mythril