Firefly开源社区

标题: 关于开机自启动 WIFI 脚本的问题 [打印本页]

作者: wx__CL2UeY    时间: 2022-7-9 14:01
标题: 关于开机自启动 WIFI 脚本的问题
本帖最后由 wx__CL2UeY 于 2022-7-18 11:12 编辑

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

log.zip

18.5 KB, 下载次数: 0, 下载积分: 灯泡 -1 , 经验 -1

WIFI_log.zip

16.17 KB, 下载次数: 0, 下载积分: 灯泡 -1 , 经验 -1


作者: wx__CL2UeY    时间: 2022-7-18 10:52
# 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
```






欢迎光临 Firefly开源社区 (https://dev.t-firefly.com/) Powered by Discuz! X3.1