Hello. I want my script to start with system startup and restart in case it breaks. I'm using the official openwrt documentation and have no idea why the script restarts when I use /etc/init.d/myscript stop and not only restarts, but creates two instances of my script.
Without procd_set_param respawn it works as expected. I understand that on stop or restart this restart parameter recognises that the script has broken down and restarts it, but I don't know how to fix it. Do you have any idea? Thanks in advance
stop_service() is called after procd already killed the service, usually stop_service() is only needed when you need additional things to do after your service has been killed by procd. The service itself should run in the foreground. The procd command should directly call your script, remove the needless "sh". For working procd examples scan the OpenWrt package repo (https://github.com/openwrt/packages).
Thanks for the response.
After stopping the service (without stop_service() function) there is no service process running anymore, but myscript.sh still works, it is not killed or restarted. That's why I userd kill $(cat $PIDFILE) previously.
Do you know why this happens?
Hello. In the autostart.sh file there is a python script running. If I call /etc/init.d/myscript stop, the autostart.sh stops, but a python script is still running. If I add killing python scipt to stop_service(), it is being respawned.