An infinite loop is the idea I also had. A freaky-looking one is:
while :; do :; done
(:
is the same as true
, does nothing and exits with zero)
You can call that in a subshell and run in the background. Doing that $num_cores
times should be enough. After sleeping the desired time you can kill them all, you get the PIDs with jobs -p
(hint: xargs
)