I am looking at run-parts
script on CentOS 7. Very similar to this:
https://github.com/ikysil/run-parts/blob/master/run-parts
It appears to run everything in the cron.hourly
etc. directories in sequence with a random delay between 1 and 300 seconds.
I have a lot of scripts in cron.hourly
I must run for my unique setup. What I would like is all of them run at same time but with random delay before each.
Something like:
directory_script_list = contents(/etc/cron.hourly)
for script in directory_script_list:
if script_is_executeable(script):
execute(sleep(random(1, 300)) && script) &)
I do not want the server swamped every hour when they hit and I also do not want one of these scripts blocking the others.
The scripts do not use much CPU load what they mostly do is query slow replying SNMP devices, lots of them and in lots of ways. Some take a long time to complete and some are very quick. Not a lot of network traffic either. There are currently about 30 scripts but I frequently add, update and remove them.
Does anyone know of something that exists like this?