Echo statements from a bash script

I have a bash script which is run by using an exec node, on a timer.
The script also generates echo statements, such as echo "script started... but they do not appear in any of the 3 exec node outputs.
I really need the outputs because they would trigger other actions in a node-RED flow.

What am I doing wrong?

Are you using spawn mode?

I've tried both, but no outputs except { code: 0 } when the script finishes.

Are you redirecting stdout in the script?:

I've tried echo "Starting daily backup..." >&1 which didn't work
is that the correct way?

Julian's script redirects the stdout at the beginning. Try commenting out the exec1 to allow the echo to be sent to stdout.

1 Like

As long as your exec node is set to output while the command is running - spawn mode, you should get a message generated by each echo command in your script.

>&1 is definitely not needed.

Can you export the timer, exec and debug nodes to share?
If the script is not confidential, share that too.

Thanks @E1cid that was the reason!!
I've commented it out, and now I get the echo statements that I need :grinning:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.