I have a expect script which does rlogin to a remote box and runs a script there on remote box.. when i run it from command prompt it runs fine... but when i run it from crontab it does not... it gets stuck when expecting a password..
can anyone help me on this please ?
=== SCRIPT =====
#!/usr/bin/expect
eval spawn rlogin b12345 -l testuser
expect "Password:"
send "test123\r"
send "/home/testuser/runScripts\r"
send "exit\r"
interact
==== crontab entry ===
sunil@homer eastLoad]$ crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.21168 installed on Sun Jul 27 15:09:39 2003)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
#!/usr/bin/expect
10 15 * * * /home/sunil/eastLoad/scriptname
i tried to run with full path also in crontab (/usr/bin/expect <script name> and /user/bin/expect -f <script name> ) but of no use...
This is what I am getting in mail
Subject: Cron <sunil@homer> /usr/bin/expect -f /home/sunil/eastLoad/runSigill
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/sunil>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=sunil>
spawn rlogin b12345 -l testuser
Password:
can anyone help me on this please ?
=== SCRIPT =====
#!/usr/bin/expect
eval spawn rlogin b12345 -l testuser
expect "Password:"
send "test123\r"
send "/home/testuser/runScripts\r"
send "exit\r"
interact
==== crontab entry ===
sunil@homer eastLoad]$ crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.21168 installed on Sun Jul 27 15:09:39 2003)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
#!/usr/bin/expect
10 15 * * * /home/sunil/eastLoad/scriptname
i tried to run with full path also in crontab (/usr/bin/expect <script name> and /user/bin/expect -f <script name> ) but of no use...
This is what I am getting in mail
Subject: Cron <sunil@homer> /usr/bin/expect -f /home/sunil/eastLoad/runSigill
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/sunil>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=sunil>
spawn rlogin b12345 -l testuser
Password: