User Tools

Site Tools


ip-address-watchdog

Simple IP-Address Watchdog

$ crontab -l
@reboot /usr/bin/sleep 60 && /usr/bin/curl -kso /dev/null https://domain.com/watchdog?hostname=$(hostname)\&address=$(/usr/sbin/ip -4 route get 1.0.0.0 | /usr/bin/awk '/dev/ { print $7 }')

Results are seen in the access.log of the webserver placed in the curl call

$ grep watchdog access.log
11.22.33.44 - - [28/May/2022:10:14:07 +0200] "GET /watchdog?hostname=kali-raspberry-pi&address=10.42.1.5 HTTP/1.1" 404 434 "-" "curl/7.83.0"
11.22.33.44 - - [28/May/2022:10:14:20 +0200] "GET /watchdog?hostname=kali-raspberry-pi&address=10.42.1.5 HTTP/1.1" 404 434 "-" "curl/7.83.0"
11.22.33.44 - - [28/May/2022:10:14:24 +0200] "GET /watchdog?hostname=kali-raspberry-pi&address=10.42.1.5 HTTP/1.1" 404 434 "-" "curl/7.83.0"
11.22.33.44 - - [28/May/2022:10:14:32 +0200] "GET /watchdog?hostname=kali-raspberry-pi&address=10.42.1.5 HTTP/1.1" 404 434 "-" "curl/7.83.0"
11.22.33.44 - - [28/May/2022:10:21:05 +0200] "GET /watchdog?hostname=kali-raspberry-pi&address=10.42.1.5 HTTP/1.1" 404 434 "-" "curl/7.83.0"
11.22.33.44 - - [28/May/2022:10:30:01 +0200] "GET /watchdog?hostname=kali-raspberry-pi&address=10.42.1.5 HTTP/1.1" 404 434 "-" "curl/7.83.0"
11.22.33.44 - - [28/May/2022:10:34:14 +0200] "GET /watchdog?hostname=kali-raspberry-pi&address=10.42.1.5 HTTP/1.1" 404 434 "-" "curl/7.83.0"
ip-address-watchdog.txt · Last modified: 2022/05/28 10:40 by baumi

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki