Rsync ssh script execution fails under cron?

Jeff Hill jhill at
Sun Jun 23 14:38:01 EST 2002

I've spent more than a day trying to write a script to backup my remote server to a local machine using ssh. The script works perfectly when I execute it directly (and I've gotten a number of variations to work okay), but I can't get cron to successfully execute it. There is no result output, so it seems cron is hanging on something, but I don't know what. 

I'm running it as root, so it doesn't seem like it would be a file permissions issue. The only time I've been able to get the script to execute was when I used a dummy remote server name (of course it reported that it failed, but cron did at least ran it).

I'm no expert, but I've written a few scripts for cron before without any problem. I appreciate that this could be considered an issue with cron and not rsync, but I thought users of rsync would probably have experience writing such cron scripts.

# \
exec expect "$0" ${1+"$@"}
# -n dry run // --progress -v  for testing
# -z for file compression
log_user 0 
spawn time /usr/bin/rsync -anrultvPz --delete --exclude="vu/" -e /usr/bin/ssh  --timeout 30 root at apache:/home/jhill/ /usr/local/bkup/home/jhill
expect "password: " 
send "secret\n" 
log_user 1 

Thanks for any suggestions,

Jeff Hill

Jeff Hill

More information about the rsync mailing list