LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-06-2005, 06:28 PM   #1
karim0028
LQ Newbie
 
Registered: Feb 2005
Posts: 3

Rep: Reputation: 0
Question Cron Job not running ssh script


Hi,

I wrote an expect script that ssh into a remote machine and kicks off a perl script. It runs fine when i run it manually; but, when i try to run it using cron it gives me errors. Is there something that i need to do with respect to cron? I think its's something to do with cron not having the correct environment variables within the remote machine.... Can anyone shed any light on this?

Thank,
Karim0028
 
Old 02-06-2005, 07:40 PM   #2
koheleth
LQ Newbie
 
Registered: Aug 2004
Distribution: Gentoo, Debian Sarge
Posts: 10

Rep: Reputation: 0
What are the errors? Is it possible to post some or all of the script (minus any sensitive info)?
 
Old 02-07-2005, 12:05 PM   #3
karim0028
LQ Newbie
 
Registered: Feb 2005
Posts: 3

Original Poster
Rep: Reputation: 0
Sorry, i posted this from home and the script was at work....

Here it is:

#!/usr/bin/expect -f

spawn -nottycopy /usr/bin/ssh root@machine.com




expect "\#" {send "cd /ult-bldsys\r"}
expect "\#" {send "export DISPLAY=:0.0\r"}
expect "#" {send "exec /usr/bin/perl /ult-bldsys/test&\r"}

#This is commented out for trial purpose, trying exec vs. spawn
#vs. send
#expect "#" {send "perl /ult-bldsys/test&\r"}

expect eof

#expect "#" {send "exit\r"}
 
Old 02-07-2005, 12:08 PM   #4
karim0028
LQ Newbie
 
Registered: Feb 2005
Posts: 3

Original Poster
Rep: Reputation: 0
Also, when i try to run this from the command line it seems to return but the perl script doesnt continue on the remote machine. If i type "interact" at the end it works. As is; it starts manually but when expect terminates, the perl script terminates

Please illuminate me if any one has any ideas of how to get it working.

Thanks,
Karim0028
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron Job with a Script bravored Linux - General 4 08-05-2005 10:27 AM
script not running as a cron job sanjith11 Programming 5 11-23-2004 08:42 AM
cron job not running vincebs Linux - Software 34 10-30-2004 01:27 PM
Cron job not running? james_cwy Linux - Newbie 6 12-14-2003 08:24 PM
Cron Job Not Running pzorn Linux - General 4 10-02-2003 01:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration