[95605] in RedHat Linux List

home help back first fref pref prev next nref lref last post

Re: Running expect script under cron

daemon@ATHENA.MIT.EDU (John H Darrah)
Mon Oct 19 18:07:00 1998

Date: Mon, 19 Oct 1998 15:06:11 -0700 (PDT)
From: John H Darrah <jhd@giddens.com>
To: "'redhat-list@redhat.com'" <redhat-list@redhat.com>
In-Reply-To: <D1DC9C040E12D1118B680060081459491F90B9@CAJUN-EXC>
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com

On Mon, 19 Oct 1998, Mike A. Lewis, CNE wrote:

> 
> I've written an expect script to periodically
> check a device on our WAN.  The script works
> fine when executed from the command line, but
> when setup as a cron job, it fails. 
> 
> [...]
> 
> Now that is good information, except for one
> thing, it doesn't tell me what the first line of
> the script should be. 
> 
> Here's the script.  Any help anyone can offer
> would be much appreciated. 
> 
> Thanks,
> Mike
> 
> 
> 		#!/usr/bin/expect -f
> 
> 		set timeout 300
> 		spawn telnet 10.39.25.1
> 		expect "login: "
> 		send root\r
> 		expect "Password: "
> 		send password\r\r
> 		expect "host241# "
> 		send "uptime | mail cajun@cajuninc.com\r"
> 		send logout\r
> 		expect "Connection closed by foreign host."
> 		interact


You don't say what the problem/error is. It fails
with what... a loud explosion???

An error message and the facility issuing it
would be helpful to diagnose the problem. 

Also note that the "interact" command is for
giving control back to the user. I don't think
it would be applicable for a cron job.



--
John Darrah (u05192)	| Dept: N/C Programming
Giddens Industries	| Ph: (425) 353-0405 #229
PO box 3190		| Ph: (206) 767-4212 #229
Everett  WA    98203	| Fx: (206) 764-9639


-- 
  PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
		http://www.redhat.com http://archive.redhat.com
         To unsubscribe: mail redhat-list-request@redhat.com with 
                       "unsubscribe" as the Subject.


home help back first fref pref prev next nref lref last post