I'm using the following to convert a video library from x264 to x265. But I can't stop it without doing a Ctrl-C on the bash script whilst it's working.

find /mnt/local/int001/media/TV/ \
\( -name '*[xXhH]264*.mkv' -o -name '*[xXhH].264*.mkv \) \
! -name '*[xX]265*' -type f -exec /usr/local/bin/ConvertTo265.sh {} +

But then the find process keeps spitting out results and the script re-triggers. How can I implement this so I can stop it when required. I have several months of conversion ahead and need to be able to stop it for maintenance etc.

  • 1
    You are missing a single quote in '*[xXhH].264*.mkv \) – guillermo chamorro Dec 1 '19 at 0:47
  • What is the problem? Doesn't Ctrl+C stop it? What's missing? – terdon Dec 1 '19 at 18:36
  • As per the answer below, it only stops the bash script. Find continues to pipe more results, which results in the script being re triggered. – aSystemOverload Dec 1 '19 at 19:16

Presumably the Ctrl-C is only killing the active conversion sub process(es). You could try using Ctrl-Z to suspend it, then kill off the suspended process with kill %1.

Alternatively spin up another terminal and kill the find process from there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.