I am trying to Implement LWM2M Client (eclipse/wakaama · GitHub) on Intel Galelio Board. I have implemented a feature where in my client ( Galileo board) will restart once executed to restart from server, but on restart my client should automatically restart which is a executable binary. I tried all option available on various forums but didn't work. I gave proper permission, updated rc.d and also it is visible in run level 3, but my binary does not get executed. Can any one please help me with this?
I have tried all the steps in this link
Using Systemd.Service i could fix this issue.
Basically you make 'services' (text files that specify the program(s) you want to run) and put them in the '/lib/systemd/system/' folder
then you run 'systemctl enable myservice' to enable the service at bootime, there are all sorts of parameters to restart the service if the process dies, or start the service before or after network interfaces are brought up.
Add a new service script to /lib/systemd/system - have a look at the scripts there alread, a good example is the iotkit-agent.service script. So you then have yourscript.service file. To start, first refresh systemd, then try to start your new service systemctl daemon-reload systemcrl start yourscript.service
You can then use 'systemctl status yourscript.service' to see if it's started and alive.
If you want it to start at boot, you have to 'enable' it systemcrl enable yourscript.service
which creates a softlink to your script from the relevant directory in /etc/systemd/system/... Now reboot and see if it comes up ok.
If your script calls a binary that needs environment vars set up, be sure to include them in the script, LD_LIBRARY_PATH is a common var needed: LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib export LD_LIBRARY_PATH
You can check this link for complete discussion & information