wifi-u盘

用香橙派lite2加脚本变成wifi-u盘,因为买了个香橙派,也实在毫无用处,大材小用了。也可以用tp703路由器(刷openwrt)。

----------------------------------------------------------------------------

#!/bin/sh -e
### BEGIN INIT INFO
# Provides:          wifi-usbdisk
# Required-Start:    
# Required-Stop:
# Default-Start:     2 3 4 5 
# Default-Stop:
# Short-Description: usbdisk  wifi.
### END INIT INFO
sh  /home/sleep  &
sh    /home/wifi-usbdisk  &
exit

------------------------------------------------------------------------------------

这个放在/etc/init.d文件夹用来开机自动启动,还得执行命令update-rc.d wifi-usbdisk defaults 90

下边是放在/home里边的sleep:

---------------------------------------------------------------------------

sleep  60s
echo 480000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

echo 0 >/sys/devices/system/cpu/cpu1/online
echo 0 >/sys/devices/system/cpu/cpu2/online
echo 0 >/sys/devices/system/cpu/cpu3/online
#cpu烫手, 几分钟自动关机,降频不管用,关cpu核心管用
#cat  /sys/class/thermal/thermal_zone0/temp

------------------------------------------------------------------------------------------
下边是放在/home里边的wifi-usbdisk

--------------------------------------------------------------------------------------

echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
#nmcli  dev   wifi   connect  OpenWrt5  password  l

url="http://192.168.123.200/Download/"

modprobe g_mass_storage  file=/home/4  stall=0  removeable=y
cat /sys/devices/platform/soc/usbc0/usb_device

if [ ! -e /tmp/tmp ]
then
mkdir  /tmp/tmp
fi

if [ ! -e /tmp/fff ]
then
mkfifo  /tmp/fff
fi
while  true
do

nc  -N  -q 0 -w 5 -l -p   7800 > /tmp/fff &
read  ddd    <  /tmp/fff

if [ $ddd = "delete" ]
then
cat /sys/devices/platform/soc/usbc0/usb_host
mount -o offset=1048576  /home/4   /mnt
rm -r /mnt/*  
umount /mnt
cat /sys/devices/platform/soc/usbc0/usb_device
echo "xxxxxxxxxx"

else
if [ -e /tmp/tmp/* ]
then
rm /tmp/tmp/*
fi
wget  -T 5    $url$ddd   -O /tmp/tmp/$ddd
cat /sys/devices/platform/soc/usbc0/usb_host
mount -o offset=1048576  /home/4   /mnt
if [ -e /tmp/tmp/* ]
then
cp  /tmp/tmp/*   /mnt/
fi
umount /mnt
cat /sys/devices/platform/soc/usbc0/usb_device
echo  "ok"
fi
done

-------------------------------------------------------------

下边是测试用的python程序

-------------------------------------------------------------

import socket
import time
addr = socket.getaddrinfo('192.168.123.171', 7800)[0][-1]
s = socket.socket()
s.connect(addr)
#s.send(b"dd")
#time.sleep(10)
s.send(b"nginx-1.19.3_Compiled.rar\n")

#s.send(b"delete\n")

s.close()
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值