echo
This commit is contained in:
parent
b8f880e7a5
commit
c121b24da5
1 changed files with 5 additions and 10 deletions
15
app.sh
15
app.sh
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
while true ; do
|
while true ; do
|
||||||
# Checks
|
echo "check variables..."
|
||||||
if [ -z "$INTERVAL" ] ; then
|
if [ -z "$INTERVAL" ] ; then
|
||||||
echo "INTERVAL is not set."
|
echo "INTERVAL is not set."
|
||||||
exit 3
|
exit 3
|
||||||
|
@ -40,8 +40,7 @@ while true ; do
|
||||||
git config --global user.email "$GIT_USER_MAIL"
|
git config --global user.email "$GIT_USER_MAIL"
|
||||||
git config --global user.name "$GIT_USERNAME"
|
git config --global user.name "$GIT_USERNAME"
|
||||||
|
|
||||||
echo clone
|
echo "clone repository..."
|
||||||
pwd
|
|
||||||
GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -i $GIT_REPO_DEPLOY_KEY" git clone "$GIT_REPO_URL" "$GIT_REPO_PATH" --quiet &> /dev/null
|
GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -i $GIT_REPO_DEPLOY_KEY" git clone "$GIT_REPO_URL" "$GIT_REPO_PATH" --quiet &> /dev/null
|
||||||
cd "$GIT_REPO_PATH"
|
cd "$GIT_REPO_PATH"
|
||||||
|
|
||||||
|
@ -60,20 +59,16 @@ while true ; do
|
||||||
echo "Error: can not export $FQDN config"
|
echo "Error: can not export $FQDN config"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
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
|
||||||
echo sed
|
|
||||||
pwd
|
|
||||||
sed -i -r '/^# [0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{2}\:[0-9]{2}\:[0-9]{2}\sby\sRouterOS\s[0-9\s\.]+/d' "config_${FQDN}.rsc"
|
sed -i -r '/^# [0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{2}\:[0-9]{2}\:[0-9]{2}\sby\sRouterOS\s[0-9\s\.]+/d' "config_${FQDN}.rsc"
|
||||||
echo add
|
|
||||||
pwd
|
|
||||||
git add "config_${FQDN}.rsc"
|
git add "config_${FQDN}.rsc"
|
||||||
echo commit
|
echo "commit config for ${FQDN} ..."
|
||||||
pwd
|
|
||||||
git commit -m "update config_${FQDN}" --quiet
|
git commit -m "update config_${FQDN}" --quiet
|
||||||
done <<< "$DEVICES"
|
done <<< "$DEVICES"
|
||||||
|
|
||||||
|
echo "push config(s)..."
|
||||||
GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -i $GIT_REPO_DEPLOY_KEY" git push &> /dev/null
|
GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -i $GIT_REPO_DEPLOY_KEY" git push &> /dev/null
|
||||||
|
|
||||||
# Restore the original IFS value
|
# Restore the original IFS value
|
||||||
|
|
Loading…
Reference in a new issue