downdetector/scripts/file_uptime.sh

20 lines
316 B
Bash
Raw Normal View History

2022-07-26 22:16:09 -04:00
#! /bin/bash
FILE="dd/conf/ips.txt"
OUTDIR="dd/logs"
#FILE=$IPFILE
#OUTDIR=$LOGSDIR
while read LINE;
do
IP=$(echo $LINE | cut -d" " -f1)
NAME=$(echo $LINE | cut -d" " -f2)
echo "Name=$NAME, IP=$IP"
ping $IP -c 1 > /dev/null || echo "$(date +"%D - %H:%M:%S"): $NAME down" >> $OUTDIR/$NAME
done < "$FILE"