I have this code to optimize image size of all my images inside /dir
directory:
find /dir/ -iregex ".*\.\(jpg\|jpeg\)" -exec jpegoptim --strip-all {} \;
When I run this code, it consumes a lot of my server CPU. So I am wondering: is it possible to me add a delay between each exec
? For example, I want 100 miliseconds of delay between each time exec
is called to every image, this way the CPU does not get very busy.
What would you suggest? My server is running Centos 8.