Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
really sorry for posting the help on this post. I havnt time to open a new post query.
I have list of servers with 2 different domain name.
pp1.servera.com
pp1.serverb.com
pp2.servera.com
pp2.serverb.com
......
single host with 2 different domain alias names for R&D purpose
now im trying to execute the remote command for file modification with help of expect and spawn
in my environment sometimes pp1.servera.com will login and pinging so no issues for executing the scripts with x.servera.com but sometimes pp1.servera.com not reachable and pp1.serverb.com will reaching. so I cant able to execute the script. here my script below
this script is working only for one suffix domain.
I want to run this script, if x.servera.com not reachable then try x.serverb.com
I have 5k servers with 2 domain alias.
my host list file have the below content
pp1
pp2
pp3
pp4
pp5
those servers have 2 domain alias for R&D purpose
.servera.com
.serverb.com
help me
Last edited by prakash0106; 08-03-2018 at 02:39 AM.
its not home work, my project requirement. as per environment, allowed to execute the remote command via expect script with bash. . but in this case listed servers are in different suffix domain name. sample below:
pp1.servera.com
pp1.serverb.com
my script working based on giving hostlist file. today I found and need to modify my script to work with short hostname and applying the dns suffix. but I cant able to do. hence I asked help on this portal.
Honestly you're better off creating a local account on the server you're running this script from and creating some ssh keys to upload those keys to each of the servers you need access to. Then you could use ssh in script without needing to worry about passwords and such.
Expect can be a tricky language to use for something beyond relatively simple things. To make it work well can take time and some level of intricacy, and even then it's not always 100% reliable.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.