openwrt 进程自动运行

在/etc/init.d/目录下创建自动运行的脚本,

xxx_init

#!/bin/sh /etc/rc.common

START=48    
STOP=10

start()
{
        service_start  /usr/sbin/xxx_init &
}

stop()
{
        service_stop  /usr/sbin/xxx_init
}

restart()
{
    stop
    start
}

执行命令:

/etc/init.d/xxx_init enable

后系统会在/etc/rc.d下生成链接文件

S48xxx.init -> ../init.d/xxx_init

其它参数功能如下:

Syntax: /etc/init.d/xxx_init [command]

Available commands:
        start           Start the service
        stop            Stop the service
        restart         Restart the service
        reload          Reload configuration files (or restart if service does not implement reload)
        enable          Enable service autostart
        disable         Disable service autostart
        enabled         Check if service is started on boot

 

posted on 2024-08-15 15:22  dingyun  阅读(180)  评论(0)    收藏  举报

导航