Expect Script not running from cron. Full Paths used | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Expect Script not running from cron. Full Paths used

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 11-06-2013
popeye's Avatar
popeye popeye is offline
Registered User
 
Join Date: Mar 2008
Last Activity: 3 November 2014, 10:23 PM EST
Posts: 86
Thanks: 16
Thanked 1 Time in 1 Post
Expect Script not running from cron. Full Paths used

My cron file. Copied $PATH

Code:
# Minute   Hour   Day of Month       Month          Day of Week        Command
SHELL=/bin/ksh
PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/perl/lib:/perl/lib/lib/perl5:/perl/scripts:.:/perl/lib/local:/home/popeye:/temp
0 12 * * * /home/popeye/xferResult &

The script

Code:
#!/usr/bin/expect 
spawn ftp -i 2.22.221.211
expect ":"
send "popeye\n"
expect ":"
sleep 1
send "thesailorman\n"
expect ">"
send "cd filestore\r"
expect ">"
send "put /home/popeye/Resulta\r"
#send "mput /home/popeye/Result*\r"
expect ">"
sleep 2 
send "bye\r"
close

The error

Quote:
spawn ftp -i 2.22.221.211
Connected to 2.22.221.211 (2.22.221.211).
220 ProFTPD 1.3.4a Server FTP Server [::ffff:2.22.221.211]
Name (2.22.221.211: popeye
331 Password required for popeye
Password:
230 User popeye logged in
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd filestore
250 CWD command successful
ftp> mput /home/popeye/Result*

local: /home/popeye/Resulta remote: /home/popeye/Resulta
227 Entering Passive Mode (2,22,221,211,66,33).
550 /home/popeye/Resulta: No such file or directory

local: /home/popeye/Resultb remote: /home/popeye/Resultb
227 Entering Passive Mode (2,22,221,211,66,34).
550 /home/popeye/Resultb: No such file or directory


local: /home/popeye/Resultc remote: /home/popeye/Resultc
227 Entering Passive Mode (2,22,221,211,66,35).
550 /home/popeye/Resultc: No such file or directory

local: /home/popeye/Resultd remote: /home/popeye/Resultd
227 Entering Passive Mode (2,22,221,211,66,36).
550 /home/popeye/Resultd: No such file or directory

ftp>
The files are there. Any help would be very appreciated.

Thanks Regards
POP

---------- Post updated 11-06-13 at 09:51 AM ---------- Previous update was 11-05-13 at 01:53 PM ----------

I solved the problem. I was wondering how to close threads. I like to keep a tidy ship.

Last edited by vbe; 11-06-2013 at 11:24 AM..
Sponsored Links
    #2  
Old 11-06-2013
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
 
Join Date: Sep 2005
Last Activity: 20 December 2014, 8:12 AM EST
Location: Switzerland - GE
Posts: 5,980
Thanks: 171
Thanked 440 Times in 412 Posts
If you solved the problem, it would be nice NOT to ask to close the thread but to explain what was the issue and the remedy applied...
Sponsored Links
    #3  
Old 11-11-2013
popeye's Avatar
popeye popeye is offline
Registered User
 
Join Date: Mar 2008
Last Activity: 3 November 2014, 10:23 PM EST
Posts: 86
Thanks: 16
Thanked 1 Time in 1 Post
To solve the problem

Use


Code:
expect ">"
send "lcd /home/popeye\r"
expect ">"
send "mput /home/popeye/Result*\r"
expect ">"

    #4  
Old 11-11-2013
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
 
Join Date: Sep 2005
Last Activity: 20 December 2014, 8:12 AM EST
Location: Switzerland - GE
Posts: 5,980
Thanks: 171
Thanked 440 Times in 412 Posts
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
expect script not running in cron "Urgent" ganga39 Shell Programming and Scripting 2 10-18-2012 01:47 PM
Using expect script with AIX's SMIT in cron Mariognarly Shell Programming and Scripting 0 02-23-2010 06:55 PM
expect and stty paths are different and resulting in error. The Nemi UNIX for Dummies Questions & Answers 6 07-17-2008 12:50 PM
Unix ls to show full paths mr_bold UNIX for Dummies Questions & Answers 3 02-05-2007 07:58 PM
expect script in cron Deepa Shell Programming and Scripting 4 03-04-2003 02:02 AM



All times are GMT -4. The time now is 02:35 PM.