Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


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

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


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?

Old 02-06-2005, 08:40 PM   #2
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, 01:05 PM   #3
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

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, 01:08 PM   #4
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.



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 11:27 AM
script not running as a cron job sanjith11 Programming 5 11-23-2004 09:42 AM
cron job not running vincebs Linux - Software 34 10-30-2004 02:27 PM
Cron job not running? james_cwy Linux - Newbie 6 12-14-2003 09:24 PM
Cron Job Not Running pzorn Linux - General 4 10-02-2003 02:38 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:32 AM.

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