add check if target is reachable
This commit is contained in:
parent
92598bf26c
commit
1a00de8c13
1 changed files with 12 additions and 7 deletions
5
app.sh
5
app.sh
|
@ -62,6 +62,8 @@ while true ; do
|
||||||
echo "Error: can not export $FQDN config"
|
echo "Error: can not export $FQDN config"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
# check if target is reachable
|
||||||
|
if ping -c1 -W1 "${FQDN}" > /dev/null; then
|
||||||
echo "export $FQDN config..."
|
echo "export $FQDN config..."
|
||||||
ssh -n -o StrictHostKeyChecking=no -i "$SSH_KEY_PATH" "${USERNAME}@${FQDN}" "/export show-sensitive" > "config_${FQDN}.rsc" 2> /dev/null
|
ssh -n -o StrictHostKeyChecking=no -i "$SSH_KEY_PATH" "${USERNAME}@${FQDN}" "/export show-sensitive" > "config_${FQDN}.rsc" 2> /dev/null
|
||||||
# entferne Datumszeile
|
# entferne Datumszeile
|
||||||
|
@ -69,6 +71,9 @@ while true ; do
|
||||||
git add "config_${FQDN}.rsc"
|
git add "config_${FQDN}.rsc"
|
||||||
echo "commit config for ${FQDN} ..."
|
echo "commit config for ${FQDN} ..."
|
||||||
git commit -m "update config_${FQDN}" --quiet > /dev/null
|
git commit -m "update config_${FQDN}" --quiet > /dev/null
|
||||||
|
else
|
||||||
|
echo "${FQDN} not reachable!"
|
||||||
|
fi
|
||||||
done <<< "$DEVICES"
|
done <<< "$DEVICES"
|
||||||
|
|
||||||
echo "push config(s)..."
|
echo "push config(s)..."
|
||||||
|
|
Loading…
Reference in a new issue