diff --git a/x b/x index d29af72..c550805 100644 --- a/x +++ b/x @@ -1,7 +1,7 @@ #!/bin/bash # setze Variable -# Format , +# Format , devices="rb5009.grote.lan,/home/mg/oxidized-selfmade/neu hex.grote.lan,/ssh/keys/hex" @@ -33,17 +33,17 @@ OLD_IFS=$IFS # Set the IFS to a comma to split the values IFS=',' -while read -r fqdn path; do +while read -r FQDN SSH_KEY_PATH; do # bereinige FQDN - fqdn=$(echo $fqdn | tr -d "[:space:]") + FQDN=$(echo "$FQDN" | tr -d "[:space:]") # prüfe ob Key existiert - if [ ! -e "$path" ]; then - echo "File file_path does not exist." + if [ ! -e "$SSH_KEY_PATH" ]; then + echo "File SSH_KEY_PATH does not exist." exit 2 fi - ssh -n -i "$path" "$fqdn" "/export show-sensitive" > "config_${fqdn}.rsc" - git add "config_${fqdn}.rsc" - git commit -m "update config_${fqdn}" + ssh -n -i "$SSH_KEY_PATH" "$FQDN" "/export show-sensitive" > "config_${FQDN}.rsc" + git add "config_${FQDN}.rsc" + git commit -m "update config_${FQDN}" done <<< "$devices" git push