crontab + rsync problem

Luca Ferrari fluca1978 at infinito.it
Thu Oct 11 08:07:05 UTC 2007


On Wednesday 10 October 2007 Andrew Glen-Young's cat, walking on the keyboard, 
wrote:
> Can you post the commands and output from the successful and
> unsuccessful command? How about the crontab entry?

This is the crontab entry:
copie at prod:~> crontab -l

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:
HOME=/home/copie
USER=copie
LOGNAME=copie
SHELL=/bin/bash

00,15,30,45 * * * 
1-6 /usr/local/bin/backup_rsync.sh /vol2/samba/camera_oscura/specifiche sede 
copie /vol2/camera_oscura > copie.log 2>&1

I've placed the variables in the crontab to ensure that the environment is set 
before the execution of the program.
The program executes:

$RSYNC ${RSYNC_OPTIONS} "${SOURCE}" "${BACKUP_TO}"

where variables have the right meaning. Now, in the log (copie.log) I can see 
the following:

Backup started at Thu Oct 11 10:00:00 CEST 2007
Rsync 
options: -a -v  --backup --backup-dir=/vol2/camera_oscura -c  -z  -x  --bwlimit=32  -vvv
Source directory: copie at sede:/vol2/samba/camera_oscura/specifiche
backup_dir is /vol2/camera_oscura/
cmd= machine=sede user=copie path=/vol2/samba/camera_oscura/specifiche
cmd[0]=ssh cmd[1]=-l cmd[2]=copie cmd[3]=sede cmd[4]=rsync cmd[5]=--server 
cmd[6]=--sender cmd[7]=-vvvvblogDtprcxz cmd[8]=--bwlimit=32 
cmd[9]=--backup-dir cmd[10]=/vol2/camera_oscura cmd[11]=. 
cmd[12]=/vol2/samba/camera_oscura/specifiche
opening connection using ssh -l copie sede 
rsync --server --sender -vvvvblogDtprcxz --bwlimit=32 --backup-dir /vol2/camera_oscura . /vol2/samba/camera_oscura/specifiche
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password,keyboard-interactive).
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
_exit_cleanup(code=12, file=io.c, line=453): entered
rsync error: unexplained error (code 255) at io.c(453) [receiver=2.6.9]
_exit_cleanup(code=12, file=io.c, line=453): about to call exit(255)
Backup started at Thu Oct 11 10:00:00 CEST 2007 ended at Thu Oct 11 10:00:00 
CEST 2007



So all the commands are executed right, but it seems that the host cannot 
connect to the remote thru ssh. Now, in my .bash_profile I've got:

eval `ssh-agent`
ssh-add $HOME/.ssh/id-dsa

that adds the rsa key for the authentication of the user to the remote host. I 
guess the problem is about this point, since the error messages remind me an 
ssh error. However I cannot understand why it works interactively and not 
thru crontab.

Any idea?




More information about the ubuntu-users mailing list