LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Cron Job not running ssh script (https://www.linuxquestions.org/questions/linux-general-1/cron-job-not-running-ssh-script-287059/)

karim0028 02-06-2005 06:28 PM

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

koheleth 02-06-2005 07:40 PM

What are the errors? Is it possible to post some or all of the script (minus any sensitive info)?

karim0028 02-07-2005 12:05 PM

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"}

karim0028 02-07-2005 12:08 PM

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


All times are GMT -5. The time now is 09:29 PM.