Page 1 of 1

Shellscript exited with non-successful status code: 5

PostPosted: Sun Jun 12, 2022 8:49 am
by martiko
Hi,
I have a really easy ShellScript, which I want to start (with a matching rule):

ocrmypdf -l deu "$1" "OCR_$1"

This ends with the folloing error (accodring to the log):

Code: Select all
2022-06-12 14:36:24.802 hazelworker[73713] [Error] Shell script failed: Error processing shell script on file /Users/Martin/Documents/PDF/Scans/OCRed/Scan_20220514_103931_001.pdf.
2022-06-12 14:36:24.802 hazelworker[73713] Shellscript exited with non-successful status code: 5
2022-06-12 14:36:26.831 hazelworker[73713] Done processing folder Scans


I first thought, that die command is not found (as probably the PATH is not correct), but 1. the command runs fine in a terminal window and when I added
say $PATH
to the script (so before ocrmypdf)
The correct path is given out, so the command should be found...

So I am quite lost, what to do... I already tried bash instead of zsh, but the result is the same..

Does anybody have a hint?

Thanks in advance
Martin

Re: Shellscript exited with non-successful status code: 5

PostPosted: Mon Jun 13, 2022 8:55 am
by Mr_Noodle
Turn on debug mode as described here: https://www.noodlesoft.com/kb/hazel-debug-mode/

That should output a little more to the logs. Also, check the return codes from ocrmypdf as exit code 5 seems a bit specific.

Re: Shellscript exited with non-successful status code: 5

PostPosted: Mon Jun 13, 2022 10:02 am
by martiko
Thanks, this helped a lot!

The Problem is the "OCR_$1"... As the filename handed over with $1 includes the complete path, this is translated to OCR_/Users/Martin/Documents/PDF/Scans/Scan_20220514_103931_001.pdf which is not a valid filename... and therefore it can't be written.

I modified the automation, to copy the file to a different folder, renamed it and then starten the OCR with:
ocrmypdf -l deu "$1" "$1"

Now it worsk fine!

Thanks again for the hints!