关于开机自启动 WIFI 脚本的问题

固件类型:官方提供的固件
固件文件名称:AIO-RV1126_RV1109-JD4_IPC_2021_1206_1919
固件下载地址:百度网盘 请输入提取码
Log日志:WIFI_log.zip

本帖最后由 wx__CL2UeY 于 2022-7-18 11:12 编辑

在自启动目录 /etc/init.d 中观看了相关文件,但对内容的编写与后续操作毫无头绪。
tchip_askquestions
log.zip (18.5 KB)
WIFI_log.zip (16.2 KB)

# WIFI 开机自动连接(Debian)

## Connmand

  • 安装
apt install connmand
connmand --version
  • 测试
connmanctl
enable wifi
scan wifi
agent on
services
connect xxxx.apk
ifconfig wlan0
  • wifi 配置文件
cd /var/lib/connman/xxx.psk
vim settings

配置信息如下:
......

## 开机自启动脚本

  • service 文件
cd /etc/systemd/system
vim rc-local.service
插入:
[Unit]
 Description=/etc/rc.local Compatibility
 ConditionPathExists=/etc/rc.local

[Service]
 Type=forking
 ExecStart=/etc/rc.local start
 TimeoutSec=0
 StandardOutput=tty
 RemainAfterExit=yes
 SysVStartPriority=99

[Install]
 WantedBy=multi-user.target
  • 启动服务
sudo systemctl enable rc-local.service
  • 自启文件
vim /etc/rc.local
插入:
#!/bin/sh -e
\#
\# rc.local
\#
\# This script is executed at the end of each multiuser runlevel.
\# Make sure that the script will "exit 0" on success or any other
\# value on error.
\#
\# In order to enable or disable this script just change the execution
\# bits.
\#
\# By default this script does nothing.

connmanctl enable wifi
connmanctl agent on
connmanctl connect xxx.psk

exit 0