Expect Script not running from cron. Full Paths used


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Expect Script not running from cron. Full Paths used
# 1  
Old 11-06-2013
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.211Smilie: 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..
# 2  
Old 11-06-2013
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...
# 3  
Old 11-11-2013
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
SmilieSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Expect script not executing via cron

Hello All, I'm having an issue getting an expect script to run as a cron job. The script executes fin if I run it from the command line but I get nothing when trying to run it as a cron job. I've researched other forums and threads and there have been references to the environment, or lack... (16 Replies)
Discussion started by: KingT617
16 Replies

2. Shell Programming and Scripting

expect script not running in cron "Urgent"

I wrote a script to download the files from sftp location to local. while running the script manually its working fine. when i schedule the same in cron its not working.... :wall::wall: here is the script: #!/bin/bash ... (2 Replies)
Discussion started by: ganga39
2 Replies

3. Shell Programming and Scripting

ps command showing full code of running script

Hi, I have a script running while rsync command is fired to push some files. The output of rsync cmd has been redirected to the script which is used to generate log files containing progress info with formatting. when I enter ps -ef | grep rsync it shows the full scripting code on the cmd line... (2 Replies)
Discussion started by: rajeevra
2 Replies

4. Shell Programming and Scripting

Expect script cronjob running but dying prematurely

I have an Ubuntu machine that I'd like to update automatically. I've written an expect script to run the aptitude package manager and update my packages. Essentially it does: aptitude update && aptitude upgrade while answering "yes" at the appropriate time. It works quite nicely when run... (4 Replies)
Discussion started by: CluelessPerson
4 Replies

5. Shell Programming and Scripting

how to debug an expect script running on a tomcat server

Hello everyone, I have a small expect script as follows; #!/usr/bin/expect -f set force_conservative 0 ;# set to 1 to force conservative mode even if ;# script wasn't run conservatively originally if {$force_conservative} { set send_slow {1 .1} proc send {ignore arg}... (1 Reply)
Discussion started by: randeel
1 Replies

6. Shell Programming and Scripting

Using expect script with AIX's SMIT in cron

My searches turned up nothing relevant, so I apologize if this has already been looked at. I am trying to run an expect script from a Solaris machine, that ssh's into an AIX machine, and interacts with a SMIT created menu system that runs a few backups for me. The expect script runs fine when... (0 Replies)
Discussion started by: Mariognarly
0 Replies

7. Shell Programming and Scripting

How to write an expect script to check if a process is running?

I'm new to expecting and i want to create a script to ssh to a device,check is a process is running and display that the process is running or not.This is what i have so far After executing this script i get an error. #!/usr/bin/expect set timeout -1 set ip "machine ip goes here" set... (5 Replies)
Discussion started by: icchi
5 Replies

8. Shell Programming and Scripting

calling expect script in ksh is failing via cron

I'm calling an expect script via a ksh script in cron and it is failing. The script runs fine if i run it manually. Does anyone know if it is an issue with compatibilty and if there is a way around it? (2 Replies)
Discussion started by: bhatia
2 Replies

9. UNIX for Dummies Questions & Answers

expect and stty paths are different and resulting in error.

Hello, i am using expect to automate file transfers to and fro with a sftp server. below is the script i am creating and executing in the main program. but i am getting the following error: the main program that creates and runs this script looks for words like "not found" in... (6 Replies)
Discussion started by: The Nemi
6 Replies

10. Shell Programming and Scripting

expect script in cron

I wrote a script using 'expect' tool to change the password of my login id, every fortnight. And I had put it as a cron job. The cron job is throwing an error ld.so.1: /usr/local/bin/expect: fatal: libtcl8.3.so: open failed: No such file or directory The environment variables are set... (4 Replies)
Discussion started by: Deepa
4 Replies
Login or Register to Ask a Question