crontab + rsync problem

Tony Arnold tony.arnold at manchester.ac.uk
Thu Oct 11 09:26:34 UTC 2007


Luca,

On Thu, 2007-10-11 at 10:07 +0200, Luca Ferrari wrote:
> 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?

I would check to see if .bash_profile is being executed when the cron
job runs.

Regards,
Tony.
-- 
Tony Arnold, IT Security Coordinator, University of Manchester,
IT Services Division, Kilburn Building, Oxford Road, Manchester M13 9PL.
T: +44 (0)161 275 6093, F: +44 (0)870 136 1004, M: +44 (0)773 330 0039
E: tony.arnold at manchester.ac.uk, H: http://www.man.ac.uk/Tony.Arnold




More information about the ubuntu-users mailing list