Milkv duo如何实现开机自启

每次启动milkv duo里面的文件都需要连接电脑进入终端输入命令,如何实现只要上电就可以自动执行程序呢

在后台启动您的程序或分叉它,以便当 shell 关闭时它仍在运行。
示例: $ 程序 </dev/null &>/dev/null &
末尾的 & 在后台启动程序。

I am english, I used google translate.

1 Like

可以写个脚本放到/etc/init.d/目录下,也可以参考 Connect to Wi-Fi on Duo S - Duo - MilkV Community这个帖子的最后部分在/mnt/system/duo-init.sh文件里加

1 Like

大佬可以具体讲一下吗,我尝试在/etc/init.d文件夹里面新写了一个脚本,内容如下:#!/bin/sh

${CVI_SHOPTS}

export SYSTEMPATH=/mnt/system/
PROJECTPATH=“/root/”

if [ -d $PROJECTPATH/project ]; then

    . $PROJECTPATH/project/main

else
. $SYSTEMPATH/blink111.sh &
fi

exit $?我想在开机时就自动启动main这个程序,但是失败了,我不知道什么原因,可以指点一下吗

Just fixed formatting in reply above.

I tried changing it to look like this, but it still didn’t work :sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob:

Simple, for shell scripts, just use “3-backticks sh” on the line above the commands, and then 3-backticks to close it. (you can use the suffixes none for no highlight, c for C, cpp for C++, etc…)

Or, just indent everything by 4-spaces (that’s 4-additional-spaces at the beginning of each line)

If my attempt at formatting the 3-backticks fails, it’s usually the key over tab and under esc.

/etc/init.d/下面的脚本是由rcS这个脚本去调用的,你看下rcS代码就知道怎么去完善了

1 Like