I should also mention that I'm using perl2exe (www.indigostar.com) to
compile this script into a binary executable. I compile it on the
system where Expect.pm and IO-Tty are installed, then copy the binary
over to another machine, i.e. the machine with the newer kernel. I
don't know if this could be part or the problem or not, so I figured I
would at least mention it.
Thanks,
-Kevin
ksc...@mi... wrote:
> In short, here is what I'm doing:
Proc::Daemon::Init unless $no_daemon;
my $exp = Expect->spawn("/bin/bash");
my $prompt = '#|\$';
$exp->exp_internal(1);
$exp->expect(5,-re=>$prompt);
$exp->clear_accum();
$exp->send("cd /home/kjs/application\n");
$exp->clear_accum();
$exp->expect(5,-re=>$prompt);
$exp->clear_accum();
$exp->send("nohup ./program -daemon &\n");
Note that "program" mush be run from a shell. Don't ask. Anyway, on
the older linux system, this work. When I run it on the newer kernel,
the last Expect send statement doesn't seem to get executed until I
either ctrl-c my Expect script or I kill -9 it. Then "program" shows
up in a ps listing. Here's what I get when I run it on the new system:
Here's the output of the Expect script on the newer Linux kernel:
Starting EXPECT pattern matching...
Expect::expect('Expect=GLOB(0x8421148)', 5, '-re', '#|\$') called at
ns_control.pl line 58
spawn id(4): list of patterns:
#1: -re `#|\\$'
bash: no job control in this shell
spawn id(4): Does `bash: no job control in this shell\r\n'
match:
pattern #1: -re `#|\\$'? No.
bash-2.04$
spawn id(4): Does `bash: no job control in this shell\r\nbash-2.04$ '
match:
pattern #1: -re `#|\\$'? YES!!
Before match string: `bash: no job control in this shell\r\nbash-2.04'
Match string: `$'
After match string: ` '
Matchlist: ()
Sending 'cd /home/kjs/application\n' to spawn id(4)
Expect::print('Expect=GLOB(0x8421148)', 'cd /home/kjs/applicaiton^J')
called at ns_control.pl line 60
Starting EXPECT pattern matching...
Expect::expect('Expect=GLOB(0x8421148)', 5, '-re', '#|\$') called at
ns_control.pl line 63
spawn id(4): list of patterns:
#1: -re `#|\\$'
spawn id(4): Does `'
match:
pattern #1: -re `#|\\$'? No.
cd /home/kjs/application
spawn id(4): Does `cd /home/kjs/application\r\n'
match:
pattern #1: -re `#|\\$'? No.
bash-2.04$
spawn id(4): Does `cd /home/kjs/application\r\nbash-2.04$ '
match:
pattern #1: -re `#|\\$'? YES!!
Before match string: `cd /home/kjs/application\r\nbash-2.04'
Match string: `$'
After match string: ` '
Matchlist: ()
Sending 'nohup ./program -daemon &\n' to spawn id(4)
Expect::print('Expect=GLOB(0x8421148)', 'nohup ./program -daemon &^J')
called at ns_control.pl line 72
Notice the "bash: no job control in this shell" at the top of the
Expect output. This the only difference between the output on the new
kernel and the old kernel. This is probably the problem. Any idea how
I can fix it?
Thanks,
-Kevin
_______________________________________________
Expectperl-discuss mailing list
Exp...@li...
https://lists.sourceforge.net/lists/listinfo/expectperl-discuss
|