I use this command:
find . \( -iname '*.jpg' -o -iname '*.jpeg' \) -print0 | xargs -0 -n 1 -P 4 jpegoptim --max=70 -s
But it fails on some images (jpegoptim receive SEGFAULT) and crash xargs, and all process fail.
How to skip fails, and continue task?
Thank
You could wrap it up in a scriptlet, like:
find . \( -iname '*.jpg' -o -iname '*.jpeg' \) -print0 | \
xargs -I@ -0 -n 1 -P 4 sh -c 'jpegoptim --max=70 -s "@" || exit 0'
, note that above won't handle some funnily named files (like e.g. with "
in it).
[update: fixed for sh -c '...'
as per comments]