From: sharmin malik Date: 2012-09-10T03:15:54+09:00 Subject: Need help with my logic Hi Experts, We have quite a lot of servers but they all are like bellow format (3 server in a pair) DK-vk-2.domain.lan DK-vh-2.domain.lan DK-vm-2.domain.lan MK-vk-3.domain.lan MK-vh-4.domain.lan MK-vm-3.domain.lan So basically the different is : k,h,v Now Problme is : I need to run a script from one of the server and it will connect to rest 2 by ssh and will run a command, which i know how to do but i dont know ,how will i know from which server i am running and how to get hostname of the rest 2 servers. example : def name_check(name) #I Assuming I am running the script from DK-vk-2.domain.lan, So i need to connect to rest 2 server @hostname1 = " DK-vm-2.domain.lan " @hostname2 = " DK-vh-2.domain.lan " ................... problem is : i need set the hostname1 and hostname2 Automatically depends on the server i am running the script. i can get the hostname of the server by using `hostname` so it might be p=`hostname' puts p =>DK-vk-2.domain.lan So if its vk , then rest 2 server will be vm,vh so the rest of 2 server would be , DK-vm-2.domain.lan , DK-vh-2.domain.lan only differerence is "m" and "h" other way round if i run the script from DK-vh-2.domain.lan , the other 2 server will be DK-vm-2.domain.lan DK-vk-2.domain.lan CAn any one help me .. i am quite stuck now ..I would be really grateful if any one can help me with this Thanks -- Posted via http://www.ruby-forum.com/.