Jump to content


Photo

WiFi connection cyclic check


  • Please log in to reply
18 replies to this topic

#1 abra

  • Senior Member
  • 115 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
  • 103 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.
Today's scientists have substituted mathematics for experiments, and they wander off through equation after equation, and eventually build a structure which has no relation to reality. Nikola Tesla

Re: WiFi connection cyclic check #3 WanWizard

  • PLi® Core member
  • 68,312 posts

+1,719
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

Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Pro (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: WiFi connection cyclic check #4 abra

  • Senior Member
  • 115 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

  • PLi® Core member
  • 68,312 posts

+1,719
Excellent

Posted 22 June 2018 - 14:22

To make cron available:

opkg install busybox-cron

To edit your crontab:

crontab -e

Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Pro (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: WiFi connection cyclic check #6 abra

  • Senior Member
  • 115 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
  • 115 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

  • PLi® Core member
  • 68,312 posts

+1,719
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.


Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Pro (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: WiFi connection cyclic check #9 abra

  • Senior Member
  • 115 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
  • 640 posts

+62
Good

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
  • 640 posts

+62
Good

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

  • PLi® Core member
  • 68,312 posts

+1,719
Excellent

Posted 22 June 2018 - 17:03

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


Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Pro (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: WiFi connection cyclic check #13 Pr2

  • PLi® Contributor
  • 6,046 posts

+256
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 of the answer.

Wanna help with OpenPLi Translation? Please read our Wiki Information for translators

Sat: Hotbird 13.0E, Astra 19.2E, Eutelsat5A 5.0W
VU+ Solo 4K: 2*DVB-S2 + 2*DVB-C/T/T2 (used in DVB-C) & Duo 4K: 2*DVB-S2X + DVB-C (FBC)

AB-Com: PULSe 4K 1*DVB-S2X (+ DVB-C/T/T2)
Edision OS Mio 4K: 1*DVB-S2X + 1*DVB-C/T/T2
 


Re: WiFi connection cyclic check #14 abra

  • Senior Member
  • 115 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
  • 8,458 posts

+327
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
  • 115 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

  • PLi® Core member
  • 68,312 posts

+1,719
Excellent

Posted 25 June 2018 - 11:08

No.


Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Pro (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: WiFi connection cyclic check #18 abra

  • Senior Member
  • 115 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

  • PLi® Core member
  • 68,312 posts

+1,719
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).


Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Pro (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