Variable Names
This commit is contained in:
parent
77c23ef27f
commit
7fd2a6727d
1 changed files with 8 additions and 8 deletions
16
x
16
x
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# setze Variable
|
# setze Variable
|
||||||
# Format <fqdn>,<path to ssh-private-key(passwordless)>
|
# Format <FQDN>,<SSH_KEY_PATH to ssh-private-key(passwordless)>
|
||||||
devices="rb5009.grote.lan,/home/mg/oxidized-selfmade/neu
|
devices="rb5009.grote.lan,/home/mg/oxidized-selfmade/neu
|
||||||
hex.grote.lan,/ssh/keys/hex"
|
hex.grote.lan,/ssh/keys/hex"
|
||||||
|
|
||||||
|
@ -33,17 +33,17 @@ OLD_IFS=$IFS
|
||||||
# Set the IFS to a comma to split the values
|
# Set the IFS to a comma to split the values
|
||||||
IFS=','
|
IFS=','
|
||||||
|
|
||||||
while read -r fqdn path; do
|
while read -r FQDN SSH_KEY_PATH; do
|
||||||
# bereinige FQDN
|
# bereinige FQDN
|
||||||
fqdn=$(echo $fqdn | tr -d "[:space:]")
|
FQDN=$(echo "$FQDN" | tr -d "[:space:]")
|
||||||
# prüfe ob Key existiert
|
# prüfe ob Key existiert
|
||||||
if [ ! -e "$path" ]; then
|
if [ ! -e "$SSH_KEY_PATH" ]; then
|
||||||
echo "File file_path does not exist."
|
echo "File SSH_KEY_PATH does not exist."
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
ssh -n -i "$path" "$fqdn" "/export show-sensitive" > "config_${fqdn}.rsc"
|
ssh -n -i "$SSH_KEY_PATH" "$FQDN" "/export show-sensitive" > "config_${FQDN}.rsc"
|
||||||
git add "config_${fqdn}.rsc"
|
git add "config_${FQDN}.rsc"
|
||||||
git commit -m "update config_${fqdn}"
|
git commit -m "update config_${FQDN}"
|
||||||
done <<< "$devices"
|
done <<< "$devices"
|
||||||
|
|
||||||
git push
|
git push
|
||||||
|
|
Loading…
Reference in a new issue