0

I have a script that runs on Linux Ubuntu Server every dat at 5am. This script backups all my SVN in this way:

 #!/bin/bash
 svnadmin dump /home/xxx/svn/p1 > /home/xxx/svn-backup/p1
 svnadmin dump /home/xxx/svn/p2 > /home/xxx/svn-backup/p2
 svnadmin dump /home/xxx/svn/p3 > /home/xxx/svn-backup/p3

The problem is that only the first project (p1) is really dumped. The rest of the projects are files with this text in them:

SVN-fs-dump-format-version: 2

UUID: 895acea3-fcd0-46fa-908a-4b43fc3278af

Revision-number: 0 Prop-content-length: 56 Content-length: 56

K 8 svn:date V 27 2009-11-12T15:25:00.461875Z PROPS-END

(edit) When running the script from command line it backups all the repositories and does this problem only when running from cron.

Why is that?

2 Answers 2

1

Maybe this is a silly question, but do repositories p2 and p3 have any committed content/revisions yet? It's obvious they are repositories, otherwise you would have error messages instead of the output you have. However, when I created an empty repository and ran svnadmin dump on it, I got exactly the behavior you describe. Try checking out a copy of the repositories and running svn log to see if there are any committed revisions. Again, maybe this is a silly question, but it's easy to check.

1
  • @Daniel. Thanks for the idea. But i forgot to mention (edited) that when i run the script from command line manually and not from the cron it dumps all the repositories. The problem occurs only when running in cron.
    – Aviv
    Jan 20, 2011 at 8:34
0

I found the solution for that. The problem was something related to the output buffering of the cron job and the cron stop the script when it reaches some limit. What i have done in order to solve the problem is two things:

  1. in the cron i redirected the output into /dev/null

    0 5 * * * /home/xxx/svn-backup/run-backup > /dev/null
    
  2. In the run-backup script i redirected the output into /dev/null too

    #!/bin/bash
    svnadmin dump /home/xxx/svn/p1 > /home/xxx/svn-backup/p1 2>/dev/null
    svnadmin dump /home/xxx/svn/p2 > /home/xxx/svn-backup/p2 2>/dev/null
    svnadmin dump /home/xxx/svn/p3 > /home/xxx/svn-backup/p3 2>/dev/null
    

That made my script working !

Update: This is actually also explained on stackoverflow - https://stackoverflow.com/questions/2323933/crontab-doesnt-finish-svndump

It seems cron terminates the execution once certain limit is reached in the stderr output buffer.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .