Find the answer to your Linux question:
Results 1 to 3 of 3
Dear all, I am trying to set up a backup system for my Ubuntu linux (8.04) laptop with a desktop linux machine (openSuse 9.x) using a combination of rsync, cron ...
  1. #1
    Just Joined!
    Join Date
    Aug 2008
    Posts
    2

    rsync using cron and ssh

    Dear all,

    I am trying to set up a backup system for my Ubuntu linux (8.04) laptop with a desktop linux machine (openSuse 9.x) using a combination of rsync, cron and ssh.
    The folowwing rsync command is working ok when I run it in a terminal (as normal user):
    Code:
    rsync -avz -e "ssh -i /home/userid/sync/PCxxxx-rsync-key" /home/userid/wanteddir/ userid@pcyyyy:/home/userid/backup/wanteddir/
    When I put this command in my crontab file (running crontab -e), the rsync command fails.
    Code:
    46 10 * * * rsync -avz -e "ssh -i /home/userid/sync/PCxxxx-rsync-key" /home/userid/wanteddir/ userid@pcyyyy:/home/userid/backup/wanteddir/
    However, the cron-log-file tells me that the job is excuted:
    Code:
    Aug 28 10:18:01 PCxxxx /USR/SBIN/CRON[19650]: (userid) CMD (rsync -avz -e "ssh -i /home/userid/sync/PCxxxx-rsync-key" /home/userid/wanteddir/ userid@pcyyyy:/home/userid/backup/wanteddir/)
    If there would be an error-message resulting from this cron-job, where can I find it? Apparently not in the file /var/log/cron.log? Also in /var/log/messages I cannot find any entry related with my cronjob

    Thanx in advance
    P.

  2. #2
    Just Joined! denniscox's Avatar
    Join Date
    Aug 2008
    Location
    Austin, Texas
    Posts
    27

    Debug Cron

    Quote Originally Posted by pietro2580 View Post
    If there would be an error-message resulting from this cron-job, where can I find it?

    cron can be run with a "-x" option
    Code:
         -x debugflag[,...]
                 Enable writing of debugging information to standard output.  One or more of the following comma-separated debugflag
                 identifiers must be specified:
    
                 bit   currently not used
                 ext   make the other debug flags more verbose
                 load  be verbose when loading crontab files
                 misc  be verbose about miscellaneous one-off events
                 pars  be verbose about parsing individual crontab lines
                 proc  be verbose about the state of the process, including all of its offspring
                 sch   be verbose when iterating through the scheduling algorithms
                 test  trace through the execution, but do not perform any actions

  3. #3
    Just Joined!
    Join Date
    Aug 2008
    Posts
    2
    Hi
    Thanx for the suggestion.
    However, what I did is put all my commands in a shell script and save the STDERR of this shell script. That pointed me to the solution. More info:
    [ubuntu] Cron combined with ssh and rsync - Ubuntu Forums
    HOWTO: SSH & Public Keys [Archive] - Ubuntu Forums

    P.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...