1、安装nohup软件
opkg -d usb install coreutils-nohup
2、编写启动脚本
vim /etc/init.d/mystart
#!/bin/sh /etc/rc.common
START=99
start(){
nohup python3 -u /mnt/TFCard/opkg/uart.py >/mnt/TFCard/opkg/output.txt 2>&1 &
}
stop(){
nohup python3 -u /mnt/TFCard/opkg/uart.py -s >/mnt/TFCard/opkg/output.txt 2>&1 &
}
restart(){
nohup python3 -u /mnt/TFCard/opkg/uart.py >/mnt/TFCard/opkg/output.txt 2>&1 &
}
chmod -R 777 init.d/mystart #设置权限,否则无法激活开机启动,提示权限不足
/etc/init.d/mystart enable #激活开机启动
/etc/init.d/mystart start #运行start函数启动程序
本站的文章和资源来自互联网或者站长的原创,按照 CC BY -NC -SA 3.0 CN协议发布和共享,转载或引用本站文章应遵循相同协议。如果有侵犯版权的资源请尽快联系站长,我们会在24h内删除有争议的资源。欢迎大家多多交流,期待共同学习进步。