编辑 /etc/init.d/dco.openwrt,以下内容
#!/bin/sh /etc/rc.common
# Copyright (C) 2018 dco.gitee.io
START=10
STOP=90
start() {
# commands to launch application
mount -o bind /userdisk/data/opt /opt
mount -o bind /userdisk/data/opt/root /root
# add auto start
/opt/etc/init.d/rc.unslung start
}
stop() {
# commands to kill application
umount /opt
}
编辑 /etc/profile,末尾添加
. /opt/etc/profile
示例 ,比如设置npc自启动
新建 文件/opt/etc/init.d/S80npc
touch /opt/etc/init.d/S80npc
vim /opt/etc/init.d/S80npc
编辑以下内容
#!/bin/sh /etc/rc.common
# /opt/etc/init.d/npc
START=80
start() {
/opt/sbin/npc -config=/opt/etc/npc/npc.conf
}
stop() {
killall npc
}