Execute an exernal .jar file, the best way

Hi everyone, I hope you can clear me the best way, my knownledge of Linux and Node Red is limited, thank you.
I have Sunricher dimmers, I've found a "bridge" via mqtt (thanks to the author for this) and I need to execute the command by console: java -jar /home/pi/sunricher/sunricher-mqtt-2.0.2-jar-with-dependencies.jar
I need to start it automatically, every startup..
Well, I suppose is possible to fine a way to execute it at every startup, scripting something on boot files, but I would know if there are also other ways. Scripting boot will not let me see the ouput in the console, if it works and is connected, there is any way to start it inside the NodeRed flow and see the output too?

I hope in future I'll have anough skills to create a Node Red module from its sources.. (hopefully the author will agree too)
Thanks for help

sorry for my newbie questions, I think console is important for debugging, if I start Node Red automatically and not by an SSH shell how and I see after its ouput?
Thank you

automatically... = how ? what platform ? what OS ? how exactly are you starting it ?

1 Like

Thank you for kind reply! Raspberry3, Raspbian, I just follower the instruction after lunching from SSH the node-red-start, I executed that command and now it starts itself after reboot.
Possible to see the console?

Run node-red-log to see the log output. Note that is a command only available as part of the Raspberry Pi install - it is not a general command that works on other platforms.

1 Like

Thnak you, may you please suggest me also (if there is) an alternative way to run a .jar file than put it on boot script? Maybe possible to start from node red and catch its console logs?
Thank you!

Have a look at the Exec node. There is also node-red-node-daemon in the catalog.

1 Like

thank you for kind reply, it works, the problem is when I edit the flow and deploy again, I need to terminate the last execution and restart process again. I have to avoid to load it twice. How this is possible?
Is it possible when I press deploy to upload new flow to terminate the execution of previous process? Thank you

The exec node should automatically kill any child process it has started when you redeploy.

1 Like