checkconnection/README.md

57 lines
1.1 KiB
Markdown
Raw Normal View History

2023-10-24 08:23:47 +02:00
## Check the internetconnection
### checkconnection.sh
Check the connection with curl or ping if not available.
### restartmodem.sh
Restart any given interface of OpenWrt.
## How to install on OpenWrt
### Download scripts and make it executeable
Wget should be installed by default on OpenWrt. (git works as well, but it's not installed by default.)
2023-10-24 08:29:11 +02:00
```
2023-10-24 08:23:47 +02:00
# wget https://git.datenkastl.org/shell-scripts/checkconnection/raw/branch/main/checkconnection.sh
# wget https://git.datenkastl.org/shell-scripts/checkconnection/raw/branch/main/restartmodem.sh
# chmod +x checkconnection.sh
# chmod +x restartmodem.sh
2023-10-24 08:29:11 +02:00
```
2023-10-24 08:23:47 +02:00
### Add restartmodem.sh as failcommand
Open checkconnection
2023-10-24 08:29:11 +02:00
```
2023-10-24 08:23:47 +02:00
# vi checkconnection.sh
2023-10-24 08:29:11 +02:00
```
2023-10-24 08:23:47 +02:00
and add the path to your *restartmodem.sh* at *failcommand=*
### Install curl if desired
2023-10-24 08:29:11 +02:00
```
2023-10-24 08:23:47 +02:00
# opkg update
# opkg install curl
2023-10-24 08:29:11 +02:00
```
2023-10-24 08:23:47 +02:00
### Add cronjob
Open crontab
2023-10-24 08:29:11 +02:00
```
2023-10-24 08:23:47 +02:00
# crontab -e
2023-10-24 08:29:11 +02:00
```
2023-10-24 08:23:47 +02:00
and add vor example
2023-10-24 08:29:11 +02:00
```
2023-10-24 08:23:47 +02:00
*/1 * * * * /root/scripts/checkconnection.sh > /dev/zero*
2023-10-24 08:29:11 +02:00
```
2023-10-24 08:23:47 +02:00
to check the connection every minute and restart the modem if the check fails.