Shellscript exited with non-successful status code: 5

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

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
martiko
 
Posts: 4
Joined: Sat Nov 14, 2020 8:48 am

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.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

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!
martiko
 
Posts: 4
Joined: Sat Nov 14, 2020 8:48 am


Return to Support