How to enter a line after an exec node is started

Thank you for the update, I’m going to see if I can reproduce it with this script.

The reason that the creds.data file cannot be found by the node-red instance that is started by your init.d script, is that the init.d script starts node-red using start-stop-daemon.

From the man page for start-stop-daemon:

-d, --chdir path
              Chdir to path before starting the process. This is done after
              the chroot if the -r|--chroot option is set. When not
              specified, start-stop-daemon will chdir to the root directory
              before starting the process.

So in this case you have two options:

  1. Put the creds.data file in the root directory "/".

  2. Add the -d option to the start-stop-daemon command, with the path to the creds.data file.

Hope this helps.

1 Like

Thanks a lot Martin.
your answer helps mee.
I choose the option to add my actual directory in the option oif the deammon, and it works :slight_smile:

start_daemon () {
        start-stop-daemon --chdir /opt/plcnext --start --
3 Likes