Computing.Net > Forums > Unix > cron/scp/expect Problem

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

cron/scp/expect Problem

Reply to Message Icon

Name: kevin
Date: July 15, 2003 at 07:38:11 Pacific
OS: unix
CPU/Ram: ..
Comment:

I've got an expect script that is run through cron everynight that is supposed to secure copy a few files from a different server as well as do a few other things. I can't use ssh-agent because I have extremely limited access to the server I need to copy from.

The problem is when I run the script through cron, it executes scp but never winds up copying the files. All the paths I have are absolute paths and I've created a wrapper to set the environment variables for LD_LIBRARY_PATH and PATH under cron.

This script works fine when run from the command line. Any ideas?

Expect script:
spawn scp IPADDRESS:/common/file.log /home/filecopy.log
expect "(yes/no)?"
send "yes\r"
expect "password:"
send "******\r"
interact

Wrapper:
#!/bin/bash

LD_LIBRARY_PATH=/usr/local/src/tcl8.3.2/unix/
export LD_LIBRARY_PATH

PATH=:/usr/sbin:/opt/openssh/bin:/usr/bin:/usr/local/bin:/apps/RCS:/usr/ccs/bin:/usr/local/sbin:/usr/bin:/usr/ucb:/etc:.:/usr/
local/bin:/apps/RCS
export PATH

/home/thescript.exp



Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: July 17, 2003 at 04:49:56 Pacific
Reply:

Try turning on expect debugging to see the output

exp_internal 1

Most likely it is a path and environment problem if the script runs interactively but not from cron.


0
Reply to Message Icon

Related Posts

See More


unix shell design FTP files in an interval



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: cron/scp/expect Problem

expect problem (please help me) www.computing.net/answers/unix/expect-problem-please-help-me/5409.html

Find match in two diff files at tim www.computing.net/answers/unix/find-match-in-two-diff-files-at-tim/8061.html

rsync, expect & cron www.computing.net/answers/unix/rsync-expect-amp-cron/7935.html