Jump to content


Photo

WiFi connection cyclic check


  • Please log in to reply
18 replies to this topic

#1 abra

  • Senior Member
  • 69 posts

0
Neutral

Posted 22 June 2018 - 12:14

How could be set in a OpenPli 6.x image a cyclic check (lets say every 5 minutes) of the WiFi connection? If the check fails, the network should be "automatically" restarted. I use OpenPli on a Vu+ Duo2, and sometimes the WiFi newtork "hangs" and needs to be restarted.



Re: WiFi connection cyclic check #2 Pippin

  • Senior Member
  • 89 posts

+2
Neutral

Posted 22 June 2018 - 12:52

A script to ping the gateway:
#!/bin/bash

x=`ping -c1 -W4 ga.te.way.IP 2>&1 | grep 100%`
if [ ! "$x" = "" ]; then
		command to restart network
fi
Change the gateway IP (normally router IP) and command to restart network. Someone here can tell you how to restart network on pli. Then a cronjob every 5 minutes executing above script. It would be better to fix the WiFi though.
Wou een grap vertellen over UDP maar wist niet of die wel aan zou komen.
HD Quad+, 2x DVB-S2 + OpenATV 5.3 + oscam 1.2_11309 + 2x 1TB HDD + 4GB Stick-> swap, EPG, logs, timeshift + 13.0-19.2-23.5-28.2, 85 cm + Synology DS414, oscam 1.2_11309

Re: WiFi connection cyclic check #3 WanWizard

  • Forum Moderator
    PLi® Core member
  • 42,398 posts

+676
Excellent

Posted 22 June 2018 - 13:00

It would be better to fix the WiFi though.

 

That. I never have a failing wifi on my VU Zero (which I use for fallback streaming).

 

You restart the network using 

/etc/init.d/networking stop
/etc/init.d/networking start

Many answers to your question can be found in our new and improved wiki.

Currently in active use: VU+Solo 4K (1xFBC, 2xS2), VU+Zero, Edision OS mini+, Amiko Viper 2TC, Zgemma H3.2TC, Zgemma H6

For testing purposes: XP1000, Formuler F1 (2xS2), Miraclebox Premium Micro (S2+C/T), ET7500 (S2), ET8500 (S2), Zgemma H2.H (S2+C), Zgemma H5.2TC, SAB TripleAlpha (S2+C/T), Galaxy 4K (FBC), VU Zero 4K, HD2400 (4xS2), ET10000 (4xS2), VU+Duo2 (1xS2), Edision OS nino


Re: WiFi connection cyclic check #4 abra

  • Senior Member
  • 69 posts

0
Neutral

Posted 22 June 2018 - 14:20

Thank you very much for help. I dont know why sometimes WiFi connection gets lost, maybe a Vu+ Duo2 driver problem?

Where can I find a description about how to set a cronjon on OpenPli ?

 

Would this script (with the real router IP address) be correct, or are there some additional brackets needed?

 

 

 

#!/bin/bash

x=`ping -c1 -W4 ga.te.way.IP 2>&1 | grep 100%`
if [ ! "$x" = "" ]; then
    /etc/init.d/networking stop
    /etc/init.d/networking start
fi


Re: WiFi connection cyclic check #5 WanWizard

  • Forum Moderator
    PLi® Core member
  • 42,398 posts

+676
Excellent

Posted 22 June 2018 - 14:22

To make cron available:

opkg install busybox-cron

To edit your crontab:

crontab -e

Many answers to your question can be found in our new and improved wiki.

Currently in active use: VU+Solo 4K (1xFBC, 2xS2), VU+Zero, Edision OS mini+, Amiko Viper 2TC, Zgemma H3.2TC, Zgemma H6

For testing purposes: XP1000, Formuler F1 (2xS2), Miraclebox Premium Micro (S2+C/T), ET7500 (S2), ET8500 (S2), Zgemma H2.H (S2+C), Zgemma H5.2TC, SAB TripleAlpha (S2+C/T), Galaxy 4K (FBC), VU Zero 4K, HD2400 (4xS2), ET10000 (4xS2), VU+Duo2 (1xS2), Edision OS nino


Re: WiFi connection cyclic check #6 abra

  • Senior Member
  • 69 posts

0
Neutral

Posted 22 June 2018 - 15:19

Ok, thanks.

Is it possible to edit the cron settings on PC and copy the file to the receiver?

Where is the crontab file located in the OpenPli image ? 



Re: WiFi connection cyclic check #7 abra

  • Senior Member
  • 69 posts

0
Neutral

Posted 22 June 2018 - 15:29

... and which is the recommended directory on OpenPli where to put the scripts scheduled by crontab? 



Re: WiFi connection cyclic check #8 WanWizard

  • Forum Moderator
    PLi® Core member
  • 42,398 posts

+676
Excellent

Posted 22 June 2018 - 15:35

Is it possible to edit the cron settings on PC and copy the file to the receiver?

Where is the crontab file located in the OpenPli image ? 

 

Yes, as long as you use an editor that supports linux line-ends. The file is /var/spool/cron/root.

 

... and which is the recommended directory on OpenPli where to put the scripts scheduled by crontab? 

 

There isn't any. I usually use /usr/local.

 

If you use autobackup, make sure you include this directory (and the cron directory) in the backup, so you don't loose it when you flash again.


Many answers to your question can be found in our new and improved wiki.

Currently in active use: VU+Solo 4K (1xFBC, 2xS2), VU+Zero, Edision OS mini+, Amiko Viper 2TC, Zgemma H3.2TC, Zgemma H6

For testing purposes: XP1000, Formuler F1 (2xS2), Miraclebox Premium Micro (S2+C/T), ET7500 (S2), ET8500 (S2), Zgemma H2.H (S2+C), Zgemma H5.2TC, SAB TripleAlpha (S2+C/T), Galaxy 4K (FBC), VU Zero 4K, HD2400 (4xS2), ET10000 (4xS2), VU+Duo2 (1xS2), Edision OS nino


Re: WiFi connection cyclic check #9 abra

  • Senior Member
  • 69 posts

0
Neutral

Posted 22 June 2018 - 15:41

Thanks for the details. I would use notepad++ to edit on PC.

I installed the busybox-cron package, but there is no "cron" directory in var/spool. Do I have to create it manually ? And can you please post a sample content of the "root" file from /var/spool/cron ?



Re: WiFi connection cyclic check #10 s3n0

  • Senior Member
  • 107 posts

+10
Neutral

Posted 22 June 2018 - 15:48

Using the CRON daemon is very simple. Just use the Google search engine and you need to know the folder where the configuration files are located (/etc/cron/crontabs/root).

 

https://en.wikipedia.org/wiki/Cron

https://www.pantz.or...n/croninfo.html

https://www.computer...ix/ucrontab.htm

 

Warning:

The use of Shell for CRON configuration may vary from full Linux distributions, because only the limited command line (BusyBox) is used in the set top boxes. Some arguments (crontab -a) in the Shell set top box may not be the same or may be quite different. However, the format of CRON configuration files is almost always identical for all versions.

 

Before changing the configuration files, stop and then rerun the CRON daemon. An example for OpenATV (I do not know what it is in OpenPLi, sorry):

root@vusolose:~# sh /etc/init.d/crond stop
Stopping crond: OK
root@vusolose:~# sh /etc/init.d/crond start
Starting crond: OK
root@vusolose:~#

Edited by s3n0, 22 June 2018 - 15:51.


Re: WiFi connection cyclic check #11 s3n0

  • Senior Member
  • 107 posts

+10
Neutral

Posted 22 June 2018 - 15:58

The above crontab config.file directory applies to OpenATV :). Sorry.

Since it is not possible to edit the post again, then I write another.
 

For OpenPLi if the Crontab is installed (opkg install busybox-cron), the location of the configuration files is as stated above:
/var/spool/cron/crontabs

So, sorry for my mistake.


Edited by s3n0, 22 June 2018 - 16:01.


Re: WiFi connection cyclic check #12 WanWizard

  • Forum Moderator
    PLi® Core member
  • 42,398 posts

+676
Excellent

Posted 22 June 2018 - 17:03

It is automatically created when you use "crontab -e", the official command to edit your crontab.


Many answers to your question can be found in our new and improved wiki.

Currently in active use: VU+Solo 4K (1xFBC, 2xS2), VU+Zero, Edision OS mini+, Amiko Viper 2TC, Zgemma H3.2TC, Zgemma H6

For testing purposes: XP1000, Formuler F1 (2xS2), Miraclebox Premium Micro (S2+C/T), ET7500 (S2), ET8500 (S2), Zgemma H2.H (S2+C), Zgemma H5.2TC, SAB TripleAlpha (S2+C/T), Galaxy 4K (FBC), VU Zero 4K, HD2400 (4xS2), ET10000 (4xS2), VU+Duo2 (1xS2), Edision OS nino


Re: WiFi connection cyclic check #13 Pr2

  • PLi® Contributor
  • 2,874 posts

+119
Excellent

Posted 23 June 2018 - 00:11

Hi,

 

Small tip if you have some doubt about your Windows PC editor, once the file is edited on PC and send back to the STB simply connect to your STB in telnet, go into the file folder and tyle:

 

dos2unix MyFileName

 

This will "clean-up" the windows edited file to make it a clean Linux file.

 

Pr2


NO SUPPORT by PM, it is a forum make your question public so everybody can benefit from the question/answer.

If you think that my answer helps you, you can press the up arrow in bottom right the answer.

 

Octagon SF-4008: Hotbird 13.0E, Astra 19.2E, Eutelsat5A 5.0W (+DVB-C)
VU+ Solo 4K: 2*DVB-S2 + 2*DVB-C/T/T2 (used in DVB-C)
Amiko Viper Combo: 1*DVB-S2 + 1*DVB-C

Zgemma H7C: 1*DVB-S2 + 2*DVB-C


Re: WiFi connection cyclic check #14 abra

  • Senior Member
  • 69 posts

0
Neutral

Posted 23 June 2018 - 12:00

After calling "crontab -e" an editor opened (I guess it is vi). I broke it with ZZ and now I have an empty "root" file under /etc/cron/crontabs.

The /var/spool/cron/crontabs directory still does not exist. Is /etc/cron/crontabs the right location ?

Could somebody help me please with some sample entries for the "root" crontab file ?


Edited by abra, 23 June 2018 - 12:03.


Re: WiFi connection cyclic check #15 athoik

  • PLi® Core member
  • 7,510 posts

+262
Excellent

Posted 23 June 2018 - 12:03

See https://help.ubuntu....unity/CronHowto
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: WiFi connection cyclic check #16 abra

  • Senior Member
  • 69 posts

0
Neutral

Posted 25 June 2018 - 10:57

Is it required to add "sh" before the the name of the script in crontab, like this (I want the script to be executed every 3 days):

 

 

* * */3 * 2 sh /usr/local/check_wifi.sh >/dev/null 2>&1

 

or just

 

 

* * */3 * 2 /usr/local/check_wifi.sh >/dev/null 2>&1

 

?



Re: WiFi connection cyclic check #17 WanWizard

  • Forum Moderator
    PLi® Core member
  • 42,398 posts

+676
Excellent

Posted 25 June 2018 - 11:08

No.


Many answers to your question can be found in our new and improved wiki.

Currently in active use: VU+Solo 4K (1xFBC, 2xS2), VU+Zero, Edision OS mini+, Amiko Viper 2TC, Zgemma H3.2TC, Zgemma H6

For testing purposes: XP1000, Formuler F1 (2xS2), Miraclebox Premium Micro (S2+C/T), ET7500 (S2), ET8500 (S2), Zgemma H2.H (S2+C), Zgemma H5.2TC, SAB TripleAlpha (S2+C/T), Galaxy 4K (FBC), VU Zero 4K, HD2400 (4xS2), ET10000 (4xS2), VU+Duo2 (1xS2), Edision OS nino


Re: WiFi connection cyclic check #18 abra

  • Senior Member
  • 69 posts

0
Neutral

Posted 25 June 2018 - 12:21

I guess the crontab "root" file is located in /etc/cron/crontabs/ because I was logged in as "root" user when calling crontab -e, is that correct ?



Re: WiFi connection cyclic check #19 WanWizard

  • Forum Moderator
    PLi® Core member
  • 42,398 posts

+676
Excellent

Posted 25 June 2018 - 16:26

There is a "system" crontab with is /etc/cron/root, and "user" crontabs which are in /etc/cron/crontabs/<username>.

 

I see that /var/spool/cron is a symlink to /etc/cron, so you should see the same in both. Not sure why that symlink is there, I assume for ease of backup (everything in /etc).


Many answers to your question can be found in our new and improved wiki.

Currently in active use: VU+Solo 4K (1xFBC, 2xS2), VU+Zero, Edision OS mini+, Amiko Viper 2TC, Zgemma H3.2TC, Zgemma H6

For testing purposes: XP1000, Formuler F1 (2xS2), Miraclebox Premium Micro (S2+C/T), ET7500 (S2), ET8500 (S2), Zgemma H2.H (S2+C), Zgemma H5.2TC, SAB TripleAlpha (S2+C/T), Galaxy 4K (FBC), VU Zero 4K, HD2400 (4xS2), ET10000 (4xS2), VU+Duo2 (1xS2), Edision OS nino





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users