关于我搞了个树莓派

折腾, 就是爱折腾~

自动连接 wifi

搞个脚本, 自动检测是否已经连接 wifi, 如果未连接, 则自动重启网络

保存到 /home, 文件名为 autowifi.py ,即 /home/autowifi.py

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/python
import os, time

def log(txt):
with open(f"/data/autowifi.log","w+") as f:
f.writelines(txt)

time.sleep(60)

while True:
s = f"********* {time.time()}wifi is up, do nothing ********\n"
if '192' not in os.popen('ifconfig | grep 192').read():
s=(f'\n****** {time.time()}wifi is down, restart... ******\n')
os.system('sudo /etc/init.d/networking restart')
log(s)
time.sleep(5*60)

搞个 shell 脚本来启动 /home/autowifi.py

touch autowifi.sh

1
2
#!/bin/sh
python /home/autowifi.py &

设置开机自动启动

使用 crontab, 命令行 crontab -e

添加 @reboot /home/autowifi.sh 到最后, 开机即可自动检测并重连

samba 服务

配置示例

1
2
3
4
5
6
7
[pi]
path = /data/disk1
writeable = yes
create mask = 0777
directory mask = 0777
public = yes
browsable = yes

windows 访问无权限

chmod 777 /data/disk1

ariac2ng

ariac rpc 配置