Search code examples
shellopenwrtautostart

How to auto start an application in openwrt?


I have created a shell with necessary functions such as start() stop() restart()

But my file is not getting started at boot time.

I have used update-rc.d command in "ubuntu" to add this file to the list of autostart applications. And it was successfully started at boot time.

But in "openwrt" I have seen an enable function. Anyone aware of how to use this enable function or is there any similar command like update-rc.d in "openwrt"

I had some reference here : http://wiki.openwrt.org/doc/techref/initscripts


Solution

  • /etc/init.d/ - directory will by automaticly readed and searching for boot function or START STOP. Starts at boot time.

    boot() {
            echo boot
            # commands to run on boot
    }
    

    START-Position then to start

    STOP-Position then to stop

    START=10 
    STOP=15
    
    start() {        
            echo start
            # commands to launch application
    }                 
    
    stop() {          
            echo stop
            # commands to kill application 
    }
    

    EDITED:

    In /etc/rc.common directory files are compiled whoes going to start on boot.

    Enable your function: /etc/init.d/your_script.sh enable

    Here you will find more information about booting http://wiki.openwrt.org/doc/techref/process.boot