Jump to content


kalehrl

Member Since 1 Apr 2010
Offline Last Active Yesterday, 07:30
-----

Posts I've Made

In Topic: Zgemma H7 RC

25 August 2024 - 11:12

Will OpenPLi be available for H17COMBO?


In Topic: network restart script

26 June 2024 - 07:19

Yes, that's what I did using my router ip address:

#!/bin/sh

## Set the correct network device in the next line. (eth0, eth1, wlan0, wlan1, ...etc) ##
NET_DEV=wlan0

## Set the location for the log file. (/home/root, /media/hdd, /media/usb, ...etc) ##
LOG_LOCATION=/home/root

LOG=$LOG_LOCATION/network_restarts.log
DATE=$(date +%Y-%m-%d)
TIME=$(date +%H:%M:%S)

## Check the presence of the log file and create a log file when it is missing. ##
if [ ! -e $LOG ]; then
    echo -e "\tNetwork Restarts\n" > $LOG
fi

## Check the size of the log file, when the log file has 250 lines rename/save the current log file and create a new log file. ##
count_log_lines() {
    LINES=$(echo -n "$(cat $LOG)" | grep -c '^')
    LOG_DT=/tmp/network_restarts_${DATE}_$(date +%H:%M).log
    if [ $LINES -ge 250 ] ; then
        mv $LOG $LOG_DT
    fi
}

IP_ADDRESS=192.168.0.1

if ! ping -c 3 $IP_ADDRESS ; then
    echo -e "\nNetwork device $NET_DEV down !!\nNetwork will now be restarted.\n"
    echo "$DATE $TIME  Restart Network device $NET_DEV" >> $LOG
    count_log_lines
    /sbin/ifdown $NET_DEV && sleep 3
    /sbin/ifup $NET_DEV
else
    echo -e "\nNetwork device $NET_DEV is active, no need to restart.\n"
fi

exit

 


In Topic: network restart script

25 June 2024 - 08:39

 

This version creates a log file and every time the network needs to be restarted, a log entry with time and date is made.
This way you can monitor the restarts of your network device over a long period.
This might help you to get more insight about when, and how many times the network needs to be restarted.
 
You can set the location for the log file in line 7 of the script.

 

It didn't work.

This morning the box is unreachable.

I noticed that the router doesn't have the receiver ip connected.

I will try modifying the script to ping router ip address instead its own.


In Topic: network restart script

24 June 2024 - 07:16

Thank you. I edited the file changing eth0 to wlan0 and set up the cron job to run the script every minute.

I will report if this fixes the problem.


In Topic: Help Wifi

19 June 2024 - 19:01

MT7601 from the same link didn't work even after installing the correct drivers.

There was some sort of kernel panic and I had to order another one, 8188 which works fine.