记录我的一些生活写照、无聊的牢骚、内心世界的活动 注册 | 登陆

华为全shell光猫备份分区脚本

华为全shell光猫备份分区脚本

用笔记本直连光猫,并下载运行一个tftp服务,把下面的tftpsvr-ip换成你自己电脑的ip,欢迎各位使用并分享自己的分区造福网友。

1.telnet登录光猫,用户root ,密码adminHW,
Login:root
Password:
WAP>su
success!
SU_WAP>shell

BusyBox v1.18.4 (2017-06-30 17:46:01 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
profile close core dump
WAP(Dopra Linux) #

2.执行以下脚本
#!/bin/sh
for i in `cat /proc/mtd|awk '{print $1}'|sed -n '2,$p'| sed 's/://g'`;
do
dd if=/dev/$i of=/tmp/$i.bin ;
done
cd /tmp
cat /proc/mtd > mtd.log
tar czvf fw.tar.gz *.bin mtd.log
tftp -p -l fw.tar.gz tftpsvr-ip
rm -f  fw.tar.gz *.bin

登陆后执行vi  backup.sh 创建一个脚本文件
按i键 进入编辑模式
复制粘贴上面的脚本
按esc键 退出编辑模式
输入:wq 保存
执行chmod u+x backup.sh
./backup.sh

« 上一篇 | 下一篇 »

发表评论

评论内容 (必填):