Linux – server has limited number of processes

I want to change all jpg images to webp. I use linux command like this:

find ./ -type f -name '*.jpg' -o -name '*.png' | xargs -P 9 -I {} sh -c 'cwebp -q 80 $1 -o $1' _ {} \;

However, my server has a limited number of processes (for my user). I got the error "Cannot fork: Resource temporarily unavailable" and the command is interrupted. How can I convert all images? Can I limit the number of processes used for the command, so that it does not stop?

Read more here:

Content Attribution

This content was originally published by Estern at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: