[slbackup-commit] CVS update: slbackup/src slbackup-cron

werner-guest@alioth.debian.org werner-guest@alioth.debian.org
Tue, 07 Dec 2004 12:31:56 -0700


  User: werner-guest
  Date: 04/12/07 12:31:56

  Modified:    src      slbackup-cron
  Log:
  cleaned up getopts.pl-code (now works on woody)
  
  Revision  Changes    Path
  1.13      +18 -24    slbackup/src/slbackup-cron
  
  Index: slbackup-cron
  ===================================================================
  RCS file: /cvsroot/slbackup/slbackup/src/slbackup-cron,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- slbackup-cron	7 Dec 2004 15:27:30 -0000	1.12
  +++ slbackup-cron	7 Dec 2004 19:31:56 -0000	1.13
  @@ -6,11 +6,12 @@
   # $Id$
   #
   
  -#use strict; # failed with the getopt's
  +#use strict; # failed with getopts.pl
   use Config::General;
   use POSIX qw(strftime);
   use Net::DNS;
   use SLBackup;
  +require 'getopts.pl';
   
   
   sub usage() {
  @@ -36,14 +37,6 @@
       exit 0;
   }
   
  -## handle commandline options
  -# thanks to /usr/share/vim/vim63/tools/shtags.pl :)
  -
  -# initialization
  -my $program;
  -$program = $0 =~ s,.*/,,;
  -require 'getopts.pl';
  -
   # parse commandline
   &Getopts ("c:l:r:o:s:hv") || &usage();
   my $conffile = $opt_c || "/etc/slbackup/slbackup.conf";
  @@ -51,29 +44,30 @@
   my $scripts_predir = $opt_r || "/etc/slbackup/pre.d";
   my $scripts_postdir = $opt_o || "/etc/slbackup/post.d";
   my $scripts_logfile = $opt_s || "/var/log/slbackup/run_scripts.log";
  -my $debug = 1 if $opt_v;
  -my $debug = 0 if ! $opt_v;
  +my $debug = 0;
  +$debug = 1 if $opt_v;
   &usage() if $opt_h;
   
  +# open logfile
  +open (LOG, ">>$logfile") or die ("Unable to open $logfile\n");
  +logger ("Starting slbackup:");
   
   # debug-output
  -if ($debug) {
  -    logger ("Debug-output:" .
  -	    "  conffile        : $conffile" .
  -	    "  logfile         : $logfile" .
  -	    "  scripts_predir  : $scripts_predir" .
  -	    "  scripts_postdir : $scripts_postdir" .
  -	    "  scripts_logfile : $scripts_logfile" .
  +if (1) {
  +    logger ("Debug-output:\n" .
  +	    "  conffile        : $conffile\n" .
  +	    "  logfile         : $logfile\n" .
  +	    "  scripts_predir  : $scripts_predir\n" .
  +	    "  scripts_postdir : $scripts_postdir\n" .
  +	    "  scripts_logfile : $scripts_logfile\n" .
   	    "End debug-output.");
   }
   
  -# open logfile
  -open (LOG, ">>$logfile") or die ("Unable to open $logfile\n");
  -logger ("Starting slbackup:");
   
   # fetch configuration
  +my $config;
   if (-r $conffile) {
  -    my $config = &slbackup_readconfig($conffile);
  +    $config = &slbackup_readconfig($conffile);
   } else {
       logger ("Unable to read config file ($conffile), exiting.");
       logger ("Finished slbackup.");
  @@ -272,7 +266,7 @@
       $execstr_clientpart .= "/";
   
       # build execute string
  -    my $execstr = "rdiff-backup --print-statistics ";
  +    $execstr = "rdiff-backup --print-statistics ";
       
       if (exists ($config->{client}->{$key}->{exclude})) {
   	if (ref ($config->{client}->{$key}->{exclude}) eq "ARRAY") {