Date: Thu, 21 Feb 2002 19:14:42 -0500 From: "James A. Arnold" <JArnold@knightridder.com> To: freebsd-questions@freebsd.org Cc: nick@rogness.net Subject: Expect script error? Message-ID: <a05100300b89b3b6ca4e0@[206.128.102.10]>
next in thread | raw e-mail | index | archive | help
I've done some searching on the net and couldn't find an
answer to solve this. This script is suppose to send out a large
file each night but always quits after sending out about 8 megs.
Below is my expect script, followed by a manual connection that
shows the expected values and finally debugging output. I'm not sure
how to interpret the informtion.
I have a similar script that shows the same '(spawn_id exp4) match
glob pattern ": "? no'
message as below but those scripts work; the difference being those scripts
send out smaller files.
Maybe I have a basic flaw in my scripting that only appears with a large file.
Thanks,
Jim
=========
06:03pm 506 ~/bin>more photos_out.exp
#! /usr/local/bin/expect -d
spawn ftp -i 192.168.0.10
expect ": "
send "jim\r"
expect ": "
send "fakepw\r"
expect "ftp> "
send "cd /www/ohio/photos/raw\r"
expect "ftp> "
send "lcd /home/jim/daily_photos\r"
expect "ftp> "
send "mput *\r"
expect "ftp> "
send "bye\r"
========
06:10pm 507 ~/bin>ftp -i 192.168.0.10
Connected to 192.168.0.10.
220 hogan.printfacility.com FTP server (Version 6.00LS) ready.
Name (192.168.0.10:jim): jim
331 Password required for jim.
Password:
230 User jim logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
========
OUTPUT FROM SCRIPT:
06:02pm 505 ~/bin>./photos_out.exp
expect version 5.32.1
argv[0] = /usr/local/bin/expect argv[1] = -d argv[2] = ./photos_out.exp
set argc 0
set argv0 "./photos_out.exp"
set argv ""
executing commands from command file ./photos_out.exp
spawn ftp -i 192.168.0.10
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {33486}
expect: does "" (spawn_id exp4) match glob pattern ": "? no
Connected to 192.168.0.10.
expect: does "Connected to 192.168.0.10.\r\n" (spawn_id exp4) match
glob pattern ": "? no
220 hogan.printfacility.com FTP server (Version 6.00LS) ready.
expect: does "Connected to 192.168.0.10.\r\n220
hogan.printfacility.com FTP server
(Version 6.00LS) ready.\r\n" (spawn_id exp4) match glob pattern ": "? no
Name (192.168.0.10:jim):
expect: does "Connected to 192.168.0.10.\r\n220
hogan.printfacility.com FTP server
(Version 6.00LS) ready.\r\nName (192.168.0.10:jim): " (spawn_id exp4)
match glob pattern ": "? yes
expect: set expect_out(0,string) ": "
expect: set expect_out(spawn_id) "exp4"
expect: set expect_out(buffer) "Connected to 192.168.0.10.\r\n220
hogan.printfacility.com
FTP server (Version 6.00LS) ready.\r\nName (192.168.0.10:jim): "
send: sending "jim\r" to { exp4 }
expect: does "" (spawn_id exp4) match glob pattern ": "? no
jim 331 Password required for jim.
expect: does "jim\r\n331 Password required for jim.\r\n"
(spawn_id exp4) match glob pattern ": "? no
Password:
expect: does "jim\r\n331 Password required for jim.\r\nPassword:"
(spawn_id exp4) match glob pattern ": "? no
expect: timed out
send: sending "fakepw\r" to { exp4 }
expect: does "jim\r\n331 Password required for jim.\r\nPassword:"
(spawn_id exp4) match glob pattern "ftp> "? no
expect: does "jim\r\n331 Password required for jim.\r\nPassword:\r\n"
(spawn_id exp4) match glob pattern "ftp> "? no
230 User jim logged in.
expect: does "jim\r\n331 Password required for jim.\r\nPassword:\r\n230
User jim logged in.\r\n" (spawn_id exp4) match glob pattern "ftp> "? no
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
expect: does "jim\r\n331 Password required for
jim.\r\nPassword:\r\n230 User jim logged
in.\r\nRemote system type is UNIX.\r\nUsing binary mode to transfer
files.\r\nftp> "
(spawn_id exp4) match glob pattern "ftp> "? yes
expect: set expect_out(0,string) "ftp> "
expect: set expect_out(spawn_id) "exp4"
expect: set expect_out(buffer) "jim\r\n331 Password required for
jim.\r\nPassword:\r\n230
User jim logged in.\r\nRemote system type is UNIX.\r\nUsing binary
mode to transfer files.\r\nftp> "
send: sending "cd /www/ohio/photos/raw\r" to { exp4 }
expect: does "" (spawn_id exp4) match glob pattern "ftp> "? no
cd /www/ohio/photos/raw
expect: does "cd /www/ohio/photos/raw\r\r\n" (spawn_id exp4) match
glob pattern "ftp> "? no
250 CWD command successful.
ftp>
expect: does "cd /www/ohio/photos/raw\r\r\n250 CWD command
successful.\r\nftp> "
(spawn_id exp4) match glob pattern "ftp> "? yes
expect: set expect_out(0,string) "ftp> "
expect: set expect_out(spawn_id) "exp4"
expect: set expect_out(buffer) "cd /www/ohio/photos/raw\r\r\n250 C
WD command successful.\r\nftp> "
send: sending "lcd /home/jim/daily_photos\r" to { exp4 }
expect: does "" (spawn_id exp4) match glob pattern "ftp> "? no
lcd /home/jim/daily_photos
expect: does "lcd /home/jim/daily_photos\r\r\n" (spawn_id exp4)
match glob pattern "ftp> "? no
Local directory now /home/jim/daily_photos
ftp>
expect: does "lcd /home/jim/daily_photos\r\r\nLocal directory now
/home/jim/daily_photos\r\nftp> "
(spawn_id exp4) match glob pattern "ftp> "? yes
expect: set expect_out(0,string) "ftp> "
expect: set expect_out(spawn_id) "exp4"
expect: set expect_out(buffer) "lcd /home/jim/daily_photos\r\r\nLocal directory
now /home/jim/daily_photos\r\nftp> "
send: sending "mput *\r" to { exp4 }
expect: does "" (spawn_id exp4) match glob pattern "ftp> "? no
mput *
expect: does "mput *\r\r\n" (spawn_id exp4) match glob pattern "ftp> "? no
local: 0221.tar.gz remote: 0221.tar.gz
expect: does "mput *\r\r\nlocal: 0221.tar.gz remote: 0221.tar.gz\r\n"
(spawn_id exp4) match glob pattern "ftp> "? no
150 Opening BINARY mode data connection for '0221.tar.gz'.
expect: does "mput *\r\r\nlocal: 0221.tar.gz remote: 0221.tar.gz\r\n150 Opening
BINARY mode data connection for '0221.tar.gz'.\r\n" (spawn_id exp4)
match glob pattern "ftp> "? no
0% |
| 0 --:-- ETA
expect: does "mput *\r\r\nlocal: 0221.tar.gz remote: 0221.tar.gz\r\n150 Opening
BINARY mode data connection for '0221.tar.gz'.\r\n\r 0% |
| 0 --:-- ETA" (spawn_id exp4) match glob pattern "ftp> "?
no
1% |*
| 833 KB 01:04 ETA
expect: does "mput *\r\r\nlocal: 0221.tar.gz remote: 0221.tar.gz\r\n150 Opening
BINARY mode data connection for '0221.tar.gz'.\r\n\r 0% |
| 0 --:-- ETA\r 1% |*
| 833 KB 01:04 ETA" (spawn_id exp4) match glob pattern "ftp> "?
no
3% |***
| 1647 KB 01:04 ETA
expect: does "mput *\r\r\nlocal: 0221.tar.gz remote:
0221.tar.gz\r\n150 Opening BINARY mode data
connection for '0221.tar.gz'.\r\n\r 0% |
| 0 --:-- ETA\r 1% |*
| 833 KB 01:04 ETA\r 3% |***
| 1647 KB 01:04 ETA" (spawn_id exp4) match glob pattern "ftp> "?
no
4% |****
| 2489 KB 01:02 ETA
expect: does "mput *\r\r\nlocal: 0221.tar.gz remote:
0221.tar.gz\r\n150 Opening BINARY mode data
connection for '0221.tar.gz'.\r\n\r 0% |
| 0 --:-- ETA\r 1% |*
| 833 KB 01:04 ETA\r 3% |***
| 1647 KB 01:04 ETA\r 4% |****
| 2489 KB 01:02 ETA" (spawn_id exp4) match glob pattern "ftp> "?
no
5% |*****
| 3246 KB 01:03 ETA
expect: does "mput *\r\r\nlocal: 0221.tar.gz remote:
0221.tar.gz\r\n150 Opening BINARY mode
data connection for '0221.tar.gz'.\r\n\r 0% |
| 0 --:-- ETA\r 1% |*
| 833 KB 01:04 ETA\r 3% |***
| 1647 KB 01:04 ETA\r 4% |****
| 2489 KB 01:02 ETA\r 5% |*****
| 3246 KB 01:03 ETA" (spawn_id exp4) match glob pattern "ftp> "?
no
7% |*******
| 4077 KB 01:01 ETA
expect: does "mput *\r\r\nlocal: 0221.tar.gz remote:
0221.tar.gz\r\n150 Opening BINARY
mode data connection for '0221.tar.gz'.\r\n\r 0% |
| 0 --:-- ETA\r 1% |*
| 833 KB 01:04 ETA\r 3% |***
| 1647 KB 01:04 ETA\r 4% |****
| 2489 KB 01:02 ETA\r 5% |*****
| 3246 KB 01:03 ETA\r 7% |*******
| 4077 KB 01:01 ETA" (spawn_id exp4) match glob pattern "ftp> "?
no
8% |********
| 4869 KB 01:01 ETA
expect: does "mput *\r\r\nlocal: 0221.tar.gz remote:
0221.tar.gz\r\n150 Opening BINARY
mode data connection for '0221.tar.gz'.\r\n\r 0% |
| 0 --:-- ETA\r 1% |*
| 833 KB 01:04 ETA\r 3% |***
| 1647 KB 01:04 ETA\r 4% |****
| 2489 KB 01:02 ETA\r 5% |*****
| 3246 KB 01:03 ETA\r 7% |*******
| 4077 KB 01:01 ETA\r 8% |********
| 4869 KB 01:01 ETA" (spawn_id exp4) match glob pattern "ftp> "?
no
10% |**********
| 5680 KB 01:00 ETA
expect: does "mput *\r\r\nlocal: 0221.tar.gz remote:
0221.tar.gz\r\n150 Opening BINARY
mode data connection for '0221.tar.gz'.\r\n\r 0% |
| 0 --:-- ETA\r 1% |*
| 833 KB 01:04 ETA\r 3% |***
| 1647 KB 01:04 ETA\r 4% |****
| 2489 KB 01:02 ETA\r 5% |*****
| 3246 KB 01:03 ETA\r 7% |*******
| 4077 KB 01:01 ETA\r 8% |********
| 4869 KB 01:01 ETA\r 10% |**********
| 5680 KB 01:00 ETA" (spawn_id exp4) match glob pattern "ftp> "?
no
11% |***********
| 6437 KB 00:59 ETA
expect: does "mput *\r\r\nlocal: 0221.tar.gz remote:
0221.tar.gz\r\n150 Opening BINARY
mode data connection for '0221.tar.gz'.\r\n\r 0% |
| 0 --:-- ETA\r 1% |*
| 833 KB 01:04 ETA\r 3% |***
| 1647 KB 01:04 ETA\r 4% |****
| 2489 KB 01:02 ETA\r 5% |*****
| 3246 KB 01:03 ETA\r 7% |*******
| 4077 KB 01:01 ETA\r 8% |********
| 4869 KB 01:01 ETA\r 10% |**********
| 5680 KB 01:00 ETA\r 11% |***********
| 6437 KB 00:59 ETA" (spawn_id exp4) match glob pattern "ftp> "?
no
13% |**************
| 7218 KB 00:59 ETA
expect: does "mput *\r\r\nlocal: 0221.tar.gz remote:
0221.tar.gz\r\n150 Opening BINARY
mode data connection for '0221.tar.gz'.\r\n\r 0% |
| 0 --:-- ETA\r 1% |*
| 833 KB 01:04 ETA\r 3% |***
| 1647 KB 01:04 ETA\r 4% |****
| 2489 KB 01:02 ETA\r 5% |*****
| 3246 KB 01:03 ETA\r 7% |*******
| 4077 KB 01:01 ETA\r 8% |********
| 4869 KB 01:01 ETA\r 10% |**********
| 5680 KB 01:00 ETA\r 11% |***********
| 6437 KB 00:59 ETA\r 13% |**************
| 7218 KB 00:59 ETA" (spawn_id exp4) match glob pattern "ftp> "?
no
14% |***************
| 8014 KB 00:58 ETA
expect: does "mput *\r\r\nlocal: 0221.tar.gz remote:
0221.tar.gz\r\n150 Opening BINARY
mode data connection for '0221.tar.gz'.\r\n\r 0% |
| 0 --:-- ETA\r 1% |*
| 833 KB 01:04 ETA\r 3% |***
| 1647 KB 01:04 ETA\r 4% |****
| 2489 KB 01:02 ETA\r 5% |*****
| 3246 KB 01:03 ETA\r 7% |*******
| 4077 KB 01:01 ETA\r 8% |********
| 4869 KB 01:01 ETA\r 10% |**********
| 5680 KB 01:00 ETA\r 11% |***********
| 6437 KB 00:59 ETA\r 13% |**************
| 7218 KB 00:59 ETA\r 14% |***************
| 8014 KB 00:58 ETA" (spawn_id exp4) match glob pattern "ftp> "?
no
expect: timed out
send: sending "bye\r" to { exp4 }
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a05100300b89b3b6ca4e0>
