Add service for OpenWrt, self-boot issue

Source: Internet
Author: User

Remember last year, wrote a program, is running on the OpenWrt, want to let the program boot from the start, the final fee of 9 New force, imitate others finally write out. But never understand why to do so, just read the open official website, suddenly suddenly dawned. Web site such as Http://wiki.openwrt.org/doc/devel/packages

This issue is described in the "Packging a Service" section. If you want to run a service on the OpenWrt (of course, this service is powered up), you need to write a startup script for the service in the/etc/init.d/directory, and you need to set start=20/stop=90 in the startup script. The following is an example of the/etc/init.d/foo

#!/bin/sh/etc/rc.common
# "new" style init script
# look at/lib/functions/service.sh in a running system for EXP Lanations of what other service_
# options can be use, and then you might want them.

start=80
app=mrelay
service_write_pid=1
service_daemonize=1

start () {
        Service_start/usr/bin /$APP
}

Stop () {
        service_stop/usr/bin/$APP
}

If the program is compiled and installed with the system at the same time, do not need additional settings, the service will boot from boot. However, if you are using OPKG to install this program, you need to run the boot script under/etc/init.d/, for the above boot script, you must run the following code, the service can be implemented to boot from boot

/etc/init.d/foo Enable
At this point will be found in the rc.d/directory more than a link to foo, if the link appears, proof boot from start OK. Cancel the startup command as follows, the link under/rc.d/will disappear after execution.

/etc/init.d/foo Disable



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.