Setting working directory for init.d service



  • I have a program that I would like to set to run when my Omega2 boots preferrably through the init service, yes I know I could just set it in /etc/rc.local but not as conveniant to start/stop/restart manually this way.

    I did find this blog post about writing an init.d service file which gets me 99% of the way there, but does not talk about the possibility of setting the working directory of the daemon, or if such a thing is even supported.

    Since it seems that man is not avaliable on the Omega or through opkg (probably a size concern I'm guessing?) I'm not sure where to look for documentation on this.



  • @Adam-Jimerson OpenWrt uses procd and the source code provides no mechanism for setting a workinf directory. I've used 2 methods to achieve a default directory.

    1. Use a script as your init.d command, in that script change to the required working directory before executing the actual binary.

    2. These days I added code to my daemon to set a working directory via uci configuration or command line parameter.

    I prefer option 2 but it takes more work.



Looks like your connection to Community was lost, please wait while we try to reconnect.