execute remote commands using plink -m commands

T

TigerX777

Guest
Hello Guys

im trying to execute some commands from a commands.txt

this is what my commands file contains


"cat /etc/SuSE-release"
"uptime | awk '{print $1 $2 $3; exit}'"
"uname -a"
"hostname -f"


when i execute my script i want to get all the information of the servers using these commands ./getserinfo.sh iphostnameslist

plink -v -ssh -batch -l "$USER" -pw "$RAWPASSWD" "$SERVER" -m commands > $FILE 2>/dev/null
RH_V=$( cat $FILE | grep cat )
UNAME=$( sed -n '2{p;q}' $FILE )
KERNEL=$( echo $UNAME | awk '{ print $2 }' )
ARCH=$( echo $UNAME | awk '{ print $12 }' )
HOSTNAMEF=$( cat $FILE | grep hostname )

but its not working do you have any idea?

Regards

Jose
 


T

TigerX777

Guest
its working now !!!

echo y | plink -v -l user -pw XXXXX ipaddress -m commands "exit"

commands file should be without quotes !
 
Last edited:


Members online


Top