树莓派/openwrt nps开机自启

第一步。(我的nps文件是在/home/nps的文件夹中。) 现在文件中创建gw.sh文件。(gw=国外,我有两台服务器,一台openwrt,两个启动脚本,方便区分

#!/bin/sh
cd /home/nps
./npc -server=你的ip:8024 -vkey=你的密码 -type=tcp < /dev/null > 
/dev/null 2>1 &

其中的第二行,是先切换到nps文件所在的文件夹中。第三行,是在服务端获取的启动nps的命令。 然后给gw.sh文件修改权限

sudo chmod 777 gw.sh

第二步。
在rc.local中添加该脚本

sudo nano /etc/rc.local

在exit 0 前增加(我两条通道,所以写了两个脚本)

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
/home/nps/gw.sh start
/home/nps/gn.sh start
exit 0

然后

sudo reboot

至此,nps就可以开机自启了

猜你喜欢

转载自blog.csdn.net/qq_40634537/article/details/127352715