Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
All, I want to be able to pass by reference into my logroll (). I have tried various code changes, but nothing is working. The line I am having issues with is &logroll($fujitapeszs); It looks like logroll is reading the file contents???

Error string reads: Uncaught exception from user code: error: can not lock open: ( sf.F02002capacity: 189.1G 4 Carp::croak('error: can not lock open:(sf.F02002 Logfile::Rotate::new('Logfile::Rotate', 'File', ' sf.F02002 4 main::logroll('/usr/local/log/fuji_tapeszs.log') called at tapesz_chk. +O0 ####################################### ## Set pragmas and modules (LC/UC) ## ####################################### require 5.6.1; use strict; use warnings; use diagnostics; use MIME::Lite (); use Logfile::Rotate (); $ENV{"PATH"} = qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/lo +g); my $wd=40; my $tpexports = qq(/usr/local/log/exports); my $hrtlabtapeszs = qq(/usr/local/log/heartlab_tapeszs.log); my $fujitapeszs = qq(/usr/local/log/fuji_tapeszs.log); my $slhtapeszs = qq(/usr/local/log/slh_tapeszs.log); open (FFFF_, "+>$tpexports") || die "could not open file: $tpexports $ +!"; open (FFF_, "+<$hrtlabtapeszs") || die "could not open file: $hrtlabta +peszs $!"; open (FF_, "+<$fujitapeszs") || die "could not open file: $fujitapeszs + $!"; #open (F_, "+<$slhtapeszs") || die "could not open file: $slhtapeszs $ +!"; system("archiver -lv|egrep 'sf.H02[0-9][0-9][0-9]' > $hrtlabtapeszs"); system("archiver -lv|egrep 'sf.F02[0-9][0-9][0-9]' > $fujitapeszs"); #system("archiver -lv|egrep 'sf.L02[0-9][0-9][0-9]' > $slhtapeszs"); select( (select(FFFF_), $|=1 ) [0] ); select( (select(FFF_), $|=1 ) [0] ); select( (select(FF_), $|=1 ) [0] ); #select( (select(F_), $|=1 ) [0] ); while (<FFF_>) { if (substr($_, 52, 5) == 0 ){ chomp $_; my $hvalustr=substr($_, 52, 5); my $htpstr=substr($_, 2, 9); #system("samexport $htpstr"); #&logroll(); print FFFF_ "$htpstr\t$hvalustr\n"; } } while (<FF_>) { if (substr($_, 52, 5) == 0 ){ chomp $_; my $fvalustr=substr($_, 52, 5); my $ftpstr=substr($_, 2, 9); #system("samexport $ftpstr"); &logroll($fujitapeszs); print FFFF_ "$ftpstr\t$fvalustr\n"; } } #while (<F_>) { # if (substr($_, 52, 5) == 0 ){ # chomp $_; # my $svalustr=substr($_, 52, 5); # my $stpstr=substr($_, 2, 9); # system ("samexport $stpstr"); # &logroll($slhtapeszs); # print FFFF_ "$stpstr\t$svalustr\n"; # } #} if ( -s $tpexports ) { print FFFF_ "\n",'-' x $wd, "\n"; print FFFF_ "TapeID\t BytesRemaining\n\n"; print FFFF_ "Please eject these as offsite permanent!\ +nOhioHealt h Unix Support"; #&mailme; #&logroll; } sub mailme { my $msg = MIME::Lite->new( From => 'stkv440 <root@>', #To => 'OHIS Operations <oper1@>', To => 'Derek Smith <dbsmith@>', Subject => "ASM Copy 2 exports", Type => 'multipart/related'); $msg->attach( Type => 'TEXT', Path => "$tpexports", Filename => "$tpexports"); #$msg->send; } #foreach ($fujitapeszs,$hrtlabtapeszs,$tpexports,$slhtapeszs) +{ #if ( -s $_ or -s $_ or -s $_ or -s $_ ) { #foreach ($_) { sub logroll { my $logs = new Logfile::Rotate (File => $_, Count => 10, Gzip => 'lib', Dir => '/usr/local/lo +g/old', Flock => 'yes', Persist => 'yes' ); $logs->rotate(); } #} #} #} #close (F_) or warn "unable to close file $!"; close (FF_) or warn "unable to close file $!"; close (FFF_) or warn "unable to close file $!"; close (FFFF_) or warn "unable to close file $!";

2005-03-14 Janitored by Arunbear - added readmore tags, as per Monastery guidelines


In reply to logfile rotate w/ pass by reference by drock

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2024-04-19 08:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found