Idea Outline
Your friend is an old fashioned cron
companion at
.
at and batch read commands from standard input or a specified file which are to be executed at a later time, using /bin/sh
Combine this with run-parts
.
run-parts - run scripts or programs in a directory
The idea is that you write a cron job which starts the scripts in the "sub folders" with the use of run-parts
.
If you want to parallelise the execution depending on the system load, you can wrap the execution of each single script with batch
.
Example
On my installations I use my own wrapper script batchme
. This provides some enhancements for mailing reports and output.
The cron.{daily,weekly,monthly} scripts are wrapped in my crontab this way:
@midnight root test -x /usr/sbin/anacron || for script in $( run-parts --list /etc/cron.daily) ; do batchme --quiet --info "cron-daily ${script}" ${script} ; done
@weekly root test -x /usr/sbin/anacron || for script in $( run-parts --list /etc/cron.weekly) ; do batchme --quiet --info "cron-weekly ${script}" ${script} ; done
@monthly root test -x /usr/sbin/anacron || for script in $( run-parts --list /etc/cron.monthly); do batchme --quiet --info "cron-monthly ${script}" ${script} ; done