hi, i am a network admin and has very minimal/no knowledge of perl programming. i have tried to write a perl script to backup a subversion repository weekly & daily. the weekly script just works fine and writes the youngest version it has backed up in the log file called last_backed_up in the specified backup directory. Now my problem is with the daily backup script, which has to read the value of the last backed up revision from the last_backed_up file and if there is any change then do the incremental backup and again overwrite the file with the youngest (lstatest revision no.) and close it. The problem here is that no error has been thrown out and no desired output either which is the latest version no. in the log file last_backed_up and the compressed output file which includes the date which it was created. The platform i am using are: RHEL 3 / perl-5.8.0-88.4 the code is as follows:
#!/usr/bin/perl -w # # Perform a daily backup of a Subversion repository, # using the previous most-recently-backed-up revision # to create just an incremental dump. my $svn_repos = "/cvs/satrang/software"; my $backups_dir = "/home/svnbkp"; my $next_backup_file = "daily-incremental-backup." . 'date +%Y%m%d'; open(IN, "$backups_dir/last_backed_up"); $previous_youngest = <IN>; chomp $previous_youngest; close IN; my $youngest = "svnlook youngest $svn_repos"; chomp $youngest; if($youngest eq $previous_youngest) { print "No new revisions to back up.\n"; exit 0; } # We need to backup from the last backed up revision # to the latest (youngest) revision in the repository $first_rev = $previous_youngest + 1; $last_rev = $youngest; print "Backing up revisions $first_rev to $last_rev...\n"; #$svnadmin_cmd = "svnadmin dump --incremental " . "--revision $first_rev:$last_rev ". " +$svn_repos > $backups_dir/$next_backup_file"; #'$svnadmin_cmd'; print "Compressing dump file...\n"; print 'gzip -9 $backups_dir/$next_backup_file'; open LOG, ">$backups_dir/last_backed_up"; print LOG $last_rev; close LOG;
and the log file is last_backed_up file contains svnlook youngest /cvs/satrang/software which has to represent a no which is the subversion's youngest no and not the command please help me out on how to solve this problem Thanks & Regards Prashant

In reply to problem in a small script by massoo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.