remotecommand.sh 556 B

1234567891011121314
  1. #!/bin/bash
  2. rm -f named-klenzel.conf
  3. /usr/bin/scp -P 4711 -i /srv/backuppc/.ssh/id_rsa 172.30.1.100:/opt/ona/etc/bind/zone_data/named-klenzel.net /scripts/remotecommand/ > /dev/null 2>&1
  4. for i in $(cat /scripts/remotecommand/named-klenzel.net | egrep '^[nhiNHI]{3}-[a-zA-Z]{2}-[sSrR]{1}[lL]{1}-[a-zA-Z]{4}' | grep -v "test" | cut -d "." -f1); do
  5. echo "Connecting to $i"
  6. ping -c 1 $i > /dev/null
  7. if [ $? -eq 0 ]; then
  8. /usr/bin/ssh -i /srv/backuppc/.ssh/id_rsa -p 4711 -o "StrictHostKeyChecking no" $i "$1"
  9. else
  10. echo "$i is not reachable"
  11. fi
  12. done