2023-11-23 20:15:31 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
echo "Usage: $(basename $0) <file>"
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$#" -ne 1 ]; then
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
ssh vps "tail -n 0 -f $1" | stdbuf -o0 grep error | while IFS= read -r line
|
|
|
|
do
|
|
|
|
title=$(basename $1)
|
|
|
|
d=$(date "+%Y/%m/%d %H:%M:%S %Z")
|
2023-11-23 20:35:24 +00:00
|
|
|
echo "$d $line"
|
2023-11-23 20:15:31 +00:00
|
|
|
body="$d\n$line"
|
|
|
|
notify-send "$title" "$body"
|
|
|
|
done
|
|
|
|
|