Shell 如何在openwrt中自动启动应用程序?
我已经创建了一个具有必要功能的shell,如 开始() 停止() 重新启动() 但我的文件在启动时无法启动Shell 如何在openwrt中自动启动应用程序?,shell,openwrt,autostart,Shell,Openwrt,Autostart,我已经创建了一个具有必要功能的shell,如 开始() 停止() 重新启动() 但我的文件在启动时无法启动 boot() { echo boot # commands to run on boot } 我在“ubuntu”中使用了updaterc.d命令将此文件添加到autostart应用程序列表中。它在启动时成功启动 boot() { echo boot # commands to run on boot } 但在“openw
boot() {
echo boot
# commands to run on boot
}
我在“ubuntu”中使用了updaterc.d命令将此文件添加到autostart应用程序列表中。它在启动时成功启动
boot() {
echo boot
# commands to run on boot
}
但在“openwrt”中,我看到了一个启用功能。是否有人知道如何使用此启用功能,或者在“openwrt”中是否有类似的命令,如update rc.d
我在这里有一些参考资料:/etc/init.d/-目录将自动读取并搜索引导功能或启动-停止。 启动时启动
boot() {
echo boot
# commands to run on boot
}
开始位置,然后开始
停止位置,然后停止
START=10
STOP=15
start() {
echo start
# commands to launch application
}
stop() {
echo stop
# commands to kill application
}
编辑:
在/etc/rc.common目录中,编译将在引导时启动的文件
启用您的功能:/etc/init.d/your_script.sh Enable
在这里,您将找到有关引导的更多信息
#!/bin/sh /etc/rc.common
/etc/init.d/
目录chmod +x /etc/init.d/<your script>
/etc/init.d/<your script> enabled && echo on
root@OpenWrt:~# /etc/init.d/system enabled && echo on
on
我已经在OpenWrt Chaos Calmer 15.05上测试了这些步骤,但它应该可以在早期版本上使用。祝你好运 如果只需要在系统启动时(启动后)运行命令: 编辑您的文件/etc/rc.local 默认情况下,它只包含注释(指定的驱动程序,但在某些早期版本中也是如此): 您可以在此处添加命令 我的例子是:
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
if grep -q '/dev/sdb2' /proc/swaps ; then swapoff /dev/sda2 ; fi
comgt -s /etc/config/init-script.comgt
这个问题与C语言无关,请删除
C
标记。我的错误。。。它被删除了..谢谢你的回复,但是链接中的内容与问题的内容是一样的。我试过了。。但不起作用,这是金子。我已经多次回到这个答案上来了。:)
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
if grep -q '/dev/sdb2' /proc/swaps ; then swapoff /dev/sda2 ; fi
comgt -s /etc/config/init-script.comgt