This commit is contained in:
Michael Grote 2023-07-21 21:01:35 +02:00
parent 50bdaa7098
commit 41861cb4d3
1 changed files with 10 additions and 0 deletions

10
app.sh
View File

@ -43,9 +43,13 @@ while true ; do
if [ -d "$GIT_REPO_PATH" ] ; then
cd "$GIT_REPO_PATH"
if [ -d ".git" ] ; then
echo pull
pwd
git pull "$GIT_REPO_REMOTE_NAME" "$GIT_REPO_BRANCH" --quiet
fi
else
echo clone
pwd
git clone "$GIT_REPO_URL" "$GIT_REPO_PATH" --quiet
fi
@ -67,8 +71,14 @@ while true ; do
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
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"
echo add
pwd
git add "config_${FQDN}.rsc"
echo commit
pwd
git commit -m "update config_${FQDN}" --quiet
done <<< "$DEVICES"