Ipv6 Availability Checking Script on Padavan

For some unknown reasons, the ipv6 got offline once in a while. After rebooting, it turned just fine. I need ipv6 to do torrenting. So here comes the demand for a script to check my ipv6 availability.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh
#ipv6 check script, reboot if fails
#url=<an ipv6-only site> || delete the "#" to take effect or replace '$url' with actual url down in the corresponding command
n=4
timeout=1000
logger -t "[ipv6]" "check BEGIN"
ping -c $n -W $timeout $url
if [ $? != 0 ];then
logger -t "[ipv6]" "failed, try reboot"
reboot
else
logger -t "[ipv6]" "working fine!"
fi
exit 0

What it does is obvious. Noted that logger -t needs two strings to display information in the log area. The script above displays information as follows.

1
2
Oct 21 17:40:00 [ipv6]:  check BEGIN
Oct 21 17:40:03 [ipv6]: working fine

However, the log area could be filled with these two information, which is not ideal. logger -t sentence could be deleted after testing.

#Settings

  1. Check Advanced settings-System settings-Services-Enable SSH. SSH might not work properly on windows due to some reason about porting. Open the corresponding ports on windows should be the solution here.

    1
    ssh admin@192.168.123.1
  2. Change directory to /etc/storage/. Files in other directories will be deleted after rebooting. We don't want our script to vanish, of course.

  3. vi ipv6_check.sh. Create a .sh script, and save the code above inside. The operations of vi is somewhat different from how we operate on windows.

  4. The script is not written into the ROM if you did not run the mtd_storage script, because of some settings of Padavan firmware.
    run /sbin/mtd_storage.sh save to save the modification.

  5. Run script regularly.
    system settings-Services-cron
    Input */10 * * * * /etc/storage/ipv6_check.sh in the Cron tab to run the script every 10 minutes.

Flashing Pixel Experience into OP 8T A Password Box by Python
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×