Home Ping.py
Post
Cancel

Ping.py

Ping is a python program that runs on a raspberry pi to restart a router using a relay and log internet outages.

Github link

Installation

Clone the repository in to your home folder on a Raspberry Pi

Add ping.py to startup

Connect the relay to the Raspberry Pi on pin 12 (GPIO 18), ground (GND) and 5V DC power. These pins can be changed in the code if needed.

Pinnout Source: https://linuxhint.com/wp-content/uploads/2022/02/image6-34.png

Bash scripts (optional)

These scrips are for looking at logs. Place the in your home folder. Make the script exicutable with:

1
sudo chmod +x <filename>

Run by using: ./filename.sh

logs.sh looks at the log file and prints it to the terminal using less. Exit with q

1
2
#! /bin/sh
less ping/Logs.txt

tlog.sh automatically updates the log in real time. Exit with ctrl + c

1
2
#! /bin/sh
tail -f ping/Logs.txt
This post is licensed under CC BY 4.0 by the author.