Florian33
Posts: 4
Joined: Thu Jul 07, 2016 12:59 am

Reboot Raspberry Pi when no outside communication

Thu Jul 07, 2016 1:18 am

Hello everyone,
To introduce the context, I'm really new to Rpie. I've got a system with many blocks (camera module, T-mobile wireless ...) and a raspberry Pie at the center.

What I want to do is to check the good communication in my system between the Rpie and the other elements. If something goes wrong (lost of com due to network ..), I want the Rpie to shutdown properly the commands and then restart by itself.

I'm looking for solutions to realize :
1) Monitoring communication with outside world (elements in my system)
2) Restart the R pie properly if something goes wrong

I was thinking about using a processor that would be used as a watchdog (like an Arduino ..) that could check the com data and then send an order to restart the Rpie. I also read that the Rpie had an internal watchdog too but I don't know if it will be relevant to use it.

Finally, I find a link where someone is suggesting using a second Rpie to talk to the first one and restart the all thing if something goes wrong.
Here is the link : http://iqjar.com/jar/raspberry-pi-reboo ... -networks/

As you can see, I'm a bit lost between the different solutions, if someone could help me to see more clearly and guide me to a possible solution in order to realize the project, it would be awesome.

Thank you for your time :)
Florian

Goraxium
Posts: 122
Joined: Tue Jan 26, 2016 1:42 pm

Re: Reboot Raspberry Pi when no outside communication

Thu Jul 07, 2016 7:39 am

Reasonably easy solution: make a program that does the following:

- download a website (like Google's homepage) to check for an internet connection (maybe to ram mounted storage to save the SD card a bit)
- if the connection isn't working, rebooth the wifi (sudo ifdown wlan0 && sudo ifupwlan0), wait 30-60 seconds, and try again
- if the connection still isn't working, reboot (sudo shutdown -r now)

Then once it's up and running, make a cron job to run it as often as needed.

User avatar
Ferdinand
Posts: 236
Joined: Sun Dec 01, 2013 2:24 pm
Location: Leiderdorp, NL

Re: Reboot Raspberry Pi when no outside communication

Thu Jul 07, 2016 8:47 am

Hi,

Ping your router or provider in a crontab script every minute. No response -> reboot your pi.

Success with your project.
Success with your project!
Ferdinand

Florian33
Posts: 4
Joined: Thu Jul 07, 2016 12:59 am

Re: Reboot Raspberry Pi when no outside communication

Thu Jul 07, 2016 2:01 pm

Reasonably easy solution: make a program that does the following:

- download a website (like Google's homepage) to check for an internet connection (maybe to ram mounted storage to save the SD card a bit)
- if the connection isn't working, rebooth the wifi (sudo ifdown wlan0 && sudo ifupwlan0), wait 30-60 seconds, and try again
- if the connection still isn't working, reboot (sudo shutdown -r now)

Then once it's up and running, make a cron job to run it as often as needed.


Ok I understand the idea, but I want to see if there is an intern communication between my Rpie and my Tmobile Wireless for example (they are linked by a port RS232). If I ping google for instance, I'll know that the Rpie is able to connect with outside but I won't know if my other devices in my system can communicate with the Rpie ? I don't know if I'm clear ?

Hi,
Ping your router or provider in a crontab script every minute. No response -> reboot your pi.
Success with your project.


Same issue with this solution. I assume can't be able to check internal communication via the ports RS232 in my system ?
Does the Rpie alone could check that without any other processor board (like Arduino ...)

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Reboot Raspberry Pi when no outside communication

Thu Jul 07, 2016 2:40 pm

Whatever is "outside" the Pi has to "ping" (via e.g.
HTTP GET request) the Pi regulary - if the Pi detects a missing
"ping" it reboots itself.

Your RS232 device can probably be made to "ping" over
the serial link too , i presume.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

Return to “Beginners”