Page 1 of 1

Shellscript strange behaviour

PostPosted: Mon Aug 05, 2024 8:17 am
by Graf_Wetter
Hi,
I have a shellscript (/bin/bash), that has been run for years as an embedded script.
When I want to use it as an external script, it doesn´t work.
But ... when I turn Hazel´s debug mode on, it does work as an external script.
What could be the reason ?
I needed the debug mode to be turned off in everyday use.
Other scripts with similar structure work without any problems.
Thanks,
Jörg

Re: Shellscript strange behaviour

PostPosted: Mon Aug 05, 2024 8:41 am
by Mr_Noodle
Can you post the script?

Re: Shellscript strange behaviour

PostPosted: Mon Aug 05, 2024 8:52 am
by Graf_Wetter
PM

Re: Shellscript strange behaviour

PostPosted: Tue Aug 06, 2024 3:05 pm
by Graf_Wetter
did you get my PM ?

Re: Shellscript strange behaviour

PostPosted: Wed Aug 07, 2024 8:31 am
by Mr_Noodle
Yes, but in the future, please use email. The PM system here is unreliable.

The script is a bit long and I don't see anything obvious. What kind of failure do you get? I suggest maybe writing out periodically to a file with diagnostics to narrow down where in the script the error is happening.

Re: Shellscript strange behaviour

PostPosted: Wed Aug 07, 2024 9:23 am
by Graf_Wetter
The script just stops and the triggered file disappears.

Re: Shellscript strange behaviour

PostPosted: Thu Aug 08, 2024 3:52 am
by Graf_Wetter
FYI
Very simple solution:
The full path to the tool cpdf had to added (2nd function on top of the script).
But: Why did it work in Debug Mode without the path ? Normal behaviour ?
Thanks.

Re: Shellscript strange behaviour

PostPosted: Thu Aug 08, 2024 8:46 am
by Mr_Noodle
Not sure why it worked in debug mode but you should always specify the full path as you cannot assume any environment variables will be set (like PATH). All debug mode does is connect to stdout/stderr and write that out to Hazel's logs.

Re: Shellscript strange behaviour

PostPosted: Thu Aug 08, 2024 9:17 am
by Graf_Wetter
Thanks !