I'm using a USB WiFi dongle on a box with openpli 9.0 but from time to time, the box looses internet connection and I have to restart network in the menu of the box for it to work again. Is there a script I can run on the box to automatically check if the network works and if not to restart it? Thanks.
network restart script
Re: network restart script #2
Posted 23 June 2024 - 22:46
Hi,
With this script you can check your network status and it will restart your network device if the network is down.
You have to set the correct network device in line 4 of the script. (eth0, eth1, wlan0, wlan1, ...etc)
You can set a cron timer to execute the script every hour or 30 minutes.
regards,
stro11
Attached Files
Edited by stro11, 23 June 2024 - 22:50.
Re: network restart script #3
Re: network restart script #4
Posted 24 June 2024 - 10:55
The best solution is to find the reason why it looses the connection. Most logical reason for connection loss is that the distance to the Access Point is to far or the location is to "shielded". You could add a long USB cable between the USB WiFi dongle, it helped me once. Better solution is add more Access Points.
Hardware: Vu+ Uno 4K SE - Vu+ Duo 4K - Fuba 78 cm - Tripleblock LNB Quad 19.2/23.5/28.2 - DS918+
Software : OpenPLi - OSCam - Settings van Hans - Autotimer - EPGImport
---------------------------------------------------------------------------------------------------------------------------------------
Remember: Upvote with the button for any user/post you find to be helpful, informative, or deserving of recognition!
---------------------------------------------------------------------------------------------------------------------------------------
Many answers to your question can be found in our new and improved wiki
Re: network restart script #5
Posted 24 June 2024 - 11:10
Attached Files
Re: network restart script #6
Posted 24 June 2024 - 11:45
I also encountered cases of the WiFi network interface freezing. The LED on the card then started blinking non-stop and the box lost connection. Even restarting the interface from the menu did not help. Only restarting the entire box restored the network, but only for a while. I was wondering why there are periods when the network works smoothly for up to weeks, and there are also times when the interface freezes several times within 2-3 hours. The problem turned out to be the WiFi channel on which the router was transmitting. It turned out that when the router was transmitting on channel 11, the problem manifested itself. When he was transmitting on channel no. 1, everything was fine. I turned off automatic channel selection on the router and permanently set channel no. 1. Since then, I have not had a single interface hang-up.
Re: network restart script #7
Posted 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.
Re: network restart script #8
Re: network restart script #9
Posted 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
Re: network restart script #10
Posted 26 June 2024 - 13:14
Hi.
I agree with @40H3X - about finding the cause of the problem. A shell-script will not solve the problem.
Internet disconnection can be a shared problem in some cases - for example: softcam connection, VPN network, RTC synchronization, use of ping/tracert commands, ... and the like.
You should rather look for the causes of the problem.
A similar case happened to me. The ethernet connection (metal cables through RJ-45 connectors) in my set-top box started to fall out. I really tried everything. Re-crimp the TwistedPair cable on both of its connectors. Buy a new original TP cable from the store. Reflash the firmware in the set-top box to the latest / to the older one. Replace HDMI and network cables. Use surge protection. Replace the WIFI router with a new one. Finally, I tried to buy and replace the entire set-top box. However, the Ethernet network drop continued even in the new set-top box.
Nothing helped. The Ethernet LAN in the set-top box still stopped working occasionally, as if it was stuck. Sometimes it happened twice a day.
In the end, only one thing helped... and that was the use of an STP cable - with "tinfoil" shielding inside the cable. That is that there is some kind of strong interference near the WIFI router and I can't figure out which source.
But now back to the main problem...
I tried to start using different USB WIFI dongles at that time. Many of them showed a weak radio (2.4 GHz) signal. Some even occasionally fell (disconnected).
I also tried such an auto-restart shell-script. But that didn't solve my problem at all at the time.
Re: network restart script #11
Posted 26 June 2024 - 14:43
Also, what most people don't seem to realize: wifi is a shared medium, in which the speed of the radio is set to the weakest client.
So even if your device says "300 Mbps" as connection speed, if you have an iphone in a second-floor kids bedroom connected to the same AP, chances are the actual speed is only a fraction of it.
And... not all AP's are made equal. I used to have Draytek AP's, and sometimes had connection issues too. Now, for the last 2 years, I have 3 Ubiquity Unifi AP's covering all rooms, and since then, no issues anymore. AP roaming works a lot better too.
Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Ultimate (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)
Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.
Many answers to your question can be found in our new and improved wiki.
Re: network restart script #12
Posted 26 June 2024 - 14:58
As I said and will repeat again, solve the cause and not the issue it brings about. With WiFi the most common problem is interference with other Access Points nearby and of course mediocre hardware. Most people will try to boost there transmit power, but this will only make things worse.
The only solution is to buy Access Points that have good hardware and can "work together" and thus have good roaming capabilities, like Unifi Access Points. I use Unifi nanoHD's and bought enough to have good coverage everywhere. I never have WiFi issues and can see clients roaming from one Access Point to the other, as they move around.
Hardware: Vu+ Uno 4K SE - Vu+ Duo 4K - Fuba 78 cm - Tripleblock LNB Quad 19.2/23.5/28.2 - DS918+
Software : OpenPLi - OSCam - Settings van Hans - Autotimer - EPGImport
---------------------------------------------------------------------------------------------------------------------------------------
Remember: Upvote with the button for any user/post you find to be helpful, informative, or deserving of recognition!
---------------------------------------------------------------------------------------------------------------------------------------
Many answers to your question can be found in our new and improved wiki
Re: network restart script #13
Posted 26 June 2024 - 15:25
Also, in my case, the primary problem was a malfunctioning metallic cable. I tried using USB WIFI, but even there there was some interference (there is no problem on smartphones, laptops, etc. and all the devices at my house are within reach through one wall at a maximum of 5-10 meters - all without problems). I personally can manage USB WIFI very well. However, the problem in my case is somewhere else. Probably a damaged microwave oven (also uses the 2.4 GHz band) which is placed near my set-top box.
In the case of the interviewer, however, the problem must be solved. Shell-script, as I wrote, is in my opinion also an insufficient solution, because other/further problems will appear next, if the internet in the set-top box continues to be regularly disconnected (and the shell script only restarts it).
Re: network restart script #14
Posted 26 June 2024 - 18:30
Microwave, DECT phone, Bluetooth, all operate in the same 2.4Ghz band. And like @40H3X wrote, other AP's on the same channel could also be a big interference.
Last year I had this in my office, neighbor with a new car with wifi hotspot, broadcasting at full power directly outside my office window...
Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Ultimate (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)
Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.
Many answers to your question can be found in our new and improved wiki.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users