daniel 4 жил өмнө
commit
987da09f9f
1 өөрчлөгдсөн 14 нэмэгдсэн , 0 устгасан
  1. 14 0
      remotecommand.sh

+ 14 - 0
remotecommand.sh

@@ -0,0 +1,14 @@
+#!/bin/bash
+rm -f named-klenzel.conf
+
+/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
+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
+	echo "Connecting to $i"
+	ping -c 1 $i > /dev/null
+
+	if [ $? -eq 0 ]; then
+		/usr/bin/ssh -i /srv/backuppc/.ssh/id_rsa -p 4711 -o "StrictHostKeyChecking no" $i "$1"
+	else
+		echo "$i is not reachable"
+	fi
+done