stas        2003/01/27 15:04:27

  Modified:    bin      site_build
  Log:
  doh! someone has modified the live script, without committing it. never
  change anything on the live site, but only on your machine and update via
  cvs.  otherwise an automatic 'cvs up' may break things and create a havoc
  
  Revision  Changes    Path
  1.10      +13 -5     modperl-docs/bin/site_build
  
  Index: site_build
  ===================================================================
  RCS file: /home/cvs/modperl-docs/bin/site_build,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- site_build        27 Jan 2003 23:00:48 -0000      1.9
  +++ site_build        27 Jan 2003 23:04:26 -0000      1.10
  @@ -21,7 +21,7 @@
   umask 0002;
   
   my $HOME = $ENV{HOME};
  -$ENV{PATH} = 
"/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/bin:/usr/X11R6/bin:$HOME";
  +$ENV{PATH} = 
"/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/bin:/usr/X11R6/bin:$HOME/bin";
   
   $ENV{PERL5LIB} = 
"$HOME/lib/perl5/5.00503:$HOME/lib/perl5/site_perl/5.005:$HOME/lib/perl5/site_perl:$HOME/lib/perl5";
   
  @@ -67,9 +67,17 @@
   }
   
   sub fs_is_full {
  -    my $x = qx{ df | grep /x2 };
  -    my ($s) = ($x =~ /(\d+)\%/);
  -    # when size(fs)>=95 we most likely will fail to create files 
  -    return $s > 94 ? 1 : 0;
  +    # get available disk space
  +    my $disk = qx{ df | grep /x2 };
  +    my ($disk_avail) = ($disk =~ /(\d+)\s+\d+\%/); # avail is before capacity
  +
  +    # get size of site
  +    my $site = qx{ du -c $rel | grep total };
  +    my ($site_size) = ($site =~ /^(\d+)/);
  +
  +    # print "site_size = $site_size , disk_avail = $disk_avail";
  +
  +    # give us a margin of 50MB
  +    return $site_size + 50*1024 > $disk_avail ? 1 : 0;
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to