I have a custom dotnet application running perfectly on the Epic Processor (PR1). I want to have this automatically execute on reboot or power up of the device and I am looking for suggestions or ideas here.
Possibility 1) I could use an exec node in an autorun node-red flow. This will require playing with file permissions and ownership. Currently the application is compiled on the EPIC itself and I am manually starting it as the shell user. The Node-Red user is not the same as the Shell user.
Possibility 2) I could add a script in the /etc/rc5.d folder and have sys init start it like all the other software on the system. This is a little more intrusive and also requires copying the execution folder over to a suitable place such as /usr/local/
These are two ideas I have thought of. Has anyone else done anything like this? Does anyone have any other ideas/suggestions.
I was hoping someone here would respond who knows what /etc/rc.5 is. :LOL. I did not get too much done over the holiday break. However, I did do a little bit of reverse engineering to determine the user and home directory used by the node-red exec node. I have confirmed that I can do for example:
mkdir -p hello && cd hello && echo hello >hello.txt
and upon restart it dutifully goes out there, creates the directory if needed, and creates the file hello.txt. I will be testing the actual application in a few days.
I also want to mention that I determined a way to install dotnet such that any user of the system can run it in any user specified directory so that the runtime logs will default into that location for examination on the fly as needed. Its not hard to do, the beauty of Linux. I should mention, if you are not experienced with Linux, don’t try these things. I am excruciatingly careful to not brick this system files. One thing I am doing for example is not touching the PATH variables and I use absolute references to commands to avoid this. (Have you ever had all your shell commands go away all of a sudden? LOL)
Terry if you think the rc5.d approach should work I will try a S95runit.sh in there as everything else ought to be up and running at that point. In particular the mmp-server. I will let everyone know how this goes in the next few days.
If it were me I would prefer the use the init.d because you can have better control on the order on which your program starts. The files in the rc5 are probably symbolic links to the files in the init.d folder. I would offer more advice but I am more familiar with systemd theses days.
@reboot was one of the first things I tried. I could not see it working, possibly some permissions issues. I have not given up on that one completely. rc5.d only because I did not see an existing rc.local, so I could try that as well.
Going back and looking at that thread Terry posted above, I wish i had spotted that earlier. I would not have started hunting around so soon. Obviously it works. Will give it a go.
EDIT: Managed to get time to test it last night. My issue was missing one file needed. @reboot with crontab is the best way to go. The application is also a console app and using the ‘screen’ command allows it to attach to a virtual terminal which remains running in the background. This allows on the ssh to the machine, screen -R to the running session, and use a simple CLI to check status and such.
Thanks all for the steering and dialog. It really helps!