LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-23-2014, 01:05 PM   #1
peppe89
LQ Newbie
 
Registered: Oct 2014
Posts: 3

Rep: Reputation: Disabled
Problem with expect launched by remote pc


Hi guys,
I have a big problem.

I have a expect file (called migrate.sh) code like this:

#!/usr/bin/expect -f
set timeout -1
spawn xl migrate VM 192.168.1.3
expect "password:"
send "pass"
interact

(this code is trying to migrate a virtual machine from a host to another one)

if I launch ./migrate.sh it works great

then, I have a C file (called test), and inside of it I have something like

if (//reading by file) {
execl ("/root/migrate.sh",0);
}

with reading by file I mean that there is a file in which a remote PC send a signal who orders to launch the migrate.sh

When the remote PC writes the order "MIGRATE", the first host accepts the signal, launches correctly migrate.sh, but it never send the password to the other host.

I am working on this since days, I can't figure it out.

Can anyone help me?
Thank you very much.
 
Old 10-24-2014, 03:12 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,001

Rep: Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629
I usually try autoexpect to see if it can create the file better than I can.
 
Old 10-27-2014, 06:06 AM   #3
peppe89
LQ Newbie
 
Registered: Oct 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thank you so much, it worked great!
 
Old 10-27-2014, 03:36 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,001

Rep: Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629
Thanks for the update.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[root@fugo trace]# sh expect.sh expect.sh: line 9: expect: command not found sivaloga Linux - Kernel 1 08-22-2013 04:29 AM
Shell script using expect to login to couple of remote servers and read "crontab -l" jaipsharma Linux - Networking 3 03-16-2013 04:59 PM
Using Expect To Execute Remote Commands samarudge Linux - Software 3 09-22-2011 04:10 AM
Perl Expect Module to give passwords for remote sudo commands vikas027 Programming 8 06-02-2011 04:12 AM
using expect scripts for remote admin jmr71769 Linux - General 3 01-21-2004 01:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration