downdetector/scripts/file_uptime.sh
2022-07-26 22:16:09 -04:00

20 lines
316 B
Bash
Executable File

#! /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"