Should be good to up to 50 times a second. You need the usleep program to make this work. This code allows processes to be run more than 60 times a minute with microsecond precision. Since my previous answer I came up with another solution that is different and perhaps better. # If minute is not up - call self recursively # Use of timeout ensures that the processes are killed if they run too long # Run all the programs in the directory in parallel # Sleep if both $delay and $counter are set # Exit if directory doesn't exist or has no files # Set the directory to first prameter and delay to second parameter # If "cronsec" is passed as a parameter then run all the delays in parallel # Run all programs in a directory in parallelĮcho "This program is used to run all programs in a directory in parallel"Įcho "or to rerun them every X seconds for one minute."Įcho "Think of this program as cron with seconds resolution."Įcho "Usage: run-parallel "Įcho " # Runs all executable files in /etc/cron.20sec every 20 seconds or 3 times a minute."Įcho "If delay parameter is missing it runs everything once and exits."Įcho "If only delay is passed then the directory /etc/c is assumed."Įcho 'if "cronsec" is passed then it runs all of these delays 2 3 4 5 6 10 12 15 20 30'Įcho "resulting in 30 20 15 12 10 6 5 4 3 2 executions per minute."
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |