I try to execute a bash script via plink. Script looks something like this:
echo "@ Starting process..."
./bin/process "process.cfg" &
disown %1
echo "@ Done!"
When i execute this script in a terminal on linux, everything works fine. After the "Done!" line I get a command prompt (as expected).
Now when I run this script via plink, the output stops afyer the "Done!" line, but plink won't return to the command prompt and "hangs" until +c.
The script is placed in a file and given to plink with the -m parameter
I tried addind 'logout', 'exit', 'set -e' at the end of the script, but it doesn't help. Also adding -batch, -T or -N to the plink command brought no success.
Any ideas on how to fix this?
Ok, it seems I had to detach stdout/err from the terminal. In a normal terminal this wouldn't matter ofcourse, but plink remained in a "busy" state because of this.
So, inside my bash script (which executed the command) I had to change:
./bin/process "process.cfg" &
to:
./bin/process "process.cfg" /dev/null 2>&1 &
plink now returns the correct "finished" state at the end of the bash script.