I have a script by a third-party company that does not work properly. It is supposed to start a process. The executable file path and its arguments are passed as the first argument ($1) to the script:
[...]
echo "Good ´ol printf-debugging in 2022"
echo $1
$1 &> /dev/null &
ExitStatus=$?
PID=$!
echo "PID = " $PID
echo "ExitStatus (before wait) = " $ExitStatus
wait $PID
echo "ExitStatus (after wait) = " $ExitStatus
[...]
This prints:
Good ´ol printf-debugging in 2022
/opt/daq-logger/daq-logger /media/sdcard/daq
PID = 493
ExitStatus (before wait) = 0
And output stops there (but the command finishes).
Changing $1 &> /dev/null & to simply $1 & does not change the output. With just $1, the output stops after printing the path (and the command finishes too).
After an hour of poking around, I noticed that the involved binary file is missing execute permissions: rwxr--r--
Why is there no error shown? How do I make it show an error? Why does the script get a PID if the process wasn't actually started? Well... apparently. If there actually is a process started, what happens with it and its stderr (i.e. why don't I see it)?