add check if target is reachable

This commit is contained in:
Michael Grote 2023-08-04 10:16:54 +02:00
parent 92598bf26c
commit 1a00de8c13

5
app.sh
View file

@ -62,6 +62,8 @@ while true ; do
echo "Error: can not export $FQDN config"
exit 2
fi
# check if target is reachable
if ping -c1 -W1 "${FQDN}" > /dev/null; then
echo "export $FQDN config..."
ssh -n -o StrictHostKeyChecking=no -i "$SSH_KEY_PATH" "${USERNAME}@${FQDN}" "/export show-sensitive" > "config_${FQDN}.rsc" 2> /dev/null
# entferne Datumszeile
@ -69,6 +71,9 @@ while true ; do
git add "config_${FQDN}.rsc"
echo "commit config for ${FQDN} ..."
git commit -m "update config_${FQDN}" --quiet > /dev/null
else
echo "${FQDN} not reachable!"
fi
done <<< "$DEVICES"
echo "push config(s)..."