Dear Friends, The content in this blog are purely based on my own opinion ,it is not reflecting any of my current or previous employers materials or official documents. All my posts here are not warranted to be free of errors. Please use at your own risk and after thorough testing in your environment. If you feel that i am violating any of the company's policies or documents, kindly mail me at jeyaseelan.hi@gmail.com,I am happy to take out those content from this blog.
Wednesday, 6 December 2017
SSH script to access multiple servers
#!/bin/ksh
#set -x
LOGFILE=/tmp/scan.log
echo " Scan test` date ` " > $LOGFILE
echo " " >>$LOGFILE
echo " " >>$LOGFILE
echo "==================================================================================================================" >>$LOGFILE
for i in ` cat /tmp/server.lst` ; do
server=`echo $i | awk -F\~ ' { print $1} ' `
echo Scan Status for $server | tee -a $LOGFILE
/usr/sbin/ping $server
var_ping=$?
if [[ $var_ping -eq 0 ]] ; then
ssh -o batchmode=yes $server true
var_date=$?
if [[ $var_date -eq 0 ]] ; then
echo $server id | tee -a $LOGFILE
ssh $server id | tee -a $LOGFILE
echo "==================================================================================================================" >>$LOGFILE
else
echo $server ========== not Accessable =========== >>$LOGFILE2
fi
else
echo $server ========== not pingable =========== >>$LOGFILE2
fi
done
Subscribe to:
Posts (Atom)
-
MIRA - Multi Instance Redo Apply - 12cR2 onwards/18C With Oracle 12c Release 2, We can enable Multi Instance Redo apply ( MIR...
-
Configuring backup purely depends on the nodes where backup appliance has been configured. Here are som of the common methods followed in mo...
-
Clone multiple snapshot databases in exadata platform quickly with less additional disk space . Traditional Method: To cre...