Multi files run at one time with cronjob

hi, I am testing my site files in my own computer (xp+php+mysql). and my site needs many cronjob ( I test use pycron under xp operation)

When I open 20+ cronjob at the same time(one minute), my computer will very slow(cpu up to 100%). and sometimes it will cause some faults. (I check the resalt, sometimes 1 or 2 files were failed)

I call a command like:

30 * * * * "C:\\Program Files\\PHP5\\php.exe" E:\\www\\mysite\\file1.php
30 * * * * "C:\\Program Files\\PHP5\\php.exe" E:\\www\\mysite\\file2.php
30 * * * * "C:\\Program Files\\PHP5\\php.exe" E:\\www\\mysite\\file3.php
... ... //20+ files on minute 30, every hour

I want to ask. if I move my site files to the server with linux operation,(maybe I will rent a cloud serve) the cronjob speed will smoothly? And all the linux system support a cron command like:

30 * * * *  sleep (7); "C:\\Program Files\\PHP5\\php.exe" E:\\www\\mysite\\file2.php

is ‘sleep’ command useful to reduce the cpu use percent?


Impossible to say without knowing the relative cpu power available on your desktop pc versus what your server has, and what your scripts are doing and how long they take to complete.

On a linux system you can use ‘nice’ to change the priority of tasks. You’d be better queuing the tasks rather than trying to run them all simultaneously, and also look at optimising the tasks so they’re not so cpu heavy.

You can run as many or as few at once as you want, Linux will be able to handle starting multiple at the same time better than windows but it will still cause a large jump in load at that time.

As has already been said, you’d be better to chain them, running on then the next, then another.

thanks friends, another question: how large is the crontab.txt support? if i have a huge list of tasks and crontab.txt almost 5mb, will it cause some questions?