资讯详情

移动光猫HG6201M定期重启设置

由于移动光猫长时间使用后网络会变慢,需要定期重启设备,但后台没有定期重启功能。因此,通过执行特定脚本,可以查阅相关信息实现定期重启。

浏览器访问http://192.168.1.1/cgi-bin/telnetenable.cgi?telnetenable=然后打开终端

telnet 192.168.1.1

用户名:root 密码:hg2x0 登陆

登录成功后,/root下新建文件reboot.sh,并使用vi编辑器,编写脚本

#!/bin/sh

sleep 1d 5h # 每次重启后睡眠1天5小时,即每两天重启一次

startTime="030000" # 03:00:00 am,即凌晨3点

endTime="040005" # 凌晨4点零5秒

while true

do

currentTime=`date "%H%M%S"` # 获得当前时间

if [[ $currentTime -ge $startTime && $currentTime -le $endTime ]]; # 循环检查时间

then

reboot # 重启

else

: # 空命令

fi

sleep 1h # 睡眠1小时

done

设置权限

chmod x /root/reboot.sh

设置启动执行,编辑//etc/profile在最后加上

/root/reboot.sh &

标签: hg6803低频振动传感器

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台