Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl Script Rebooting OS

Status
Not open for further replies.

sasuser2006

Technical User
May 8, 2006
32
US
I am running a perl script on a brand new linux box and I've executed it three times and all three times the OS has rebooted mid way through the script.

I've ran the script successfully on a 10 record file and it works but the file I need to run it on is 192MM records and 1109 bytes long ~220GB.

My thought is maybe there is a setting that needs tweaking on the box or there is a parameter I can pass in the script. Any help troubleshooting would be appreciated. Thanks in advance for the help.

Code:
#!/usr/bin/perl

my $total_recs=0;
my $good_recs=0;
my $bad_recs=0;

open(BAD,">/u02/staging/$ARGV[1].bad");
open(GOOD,">/u02/staging/$ARGV[1].good");

while(<STDIN>)
{
        $total_recs++;
        chomp;
        $record_length = length($_);

        if ($record_length == $ARGV[0])
        {
                print GOOD "$_\n";
                $good_recs++;
        }
        else
        {
                print BAD "$_\n";
                $bad_recs++;
        }
}
print STDERR "<$total_recs> records read by script\n\n";
print STDERR "<$bad_recs> records written to $ARGV[1].bad\n\n";
print STDERR "<$good_recs> records written to $ARGV[1].good\n\n";
close BAD;
close GOOD;
 
I don't think this is a perl problem.

Did you look for error messages in your Linux log files?
For example /var/log/messages or /var/log/syslog, but it could be somewhere else on your system.

For a test, you could try other commands than perl;
for example check if this will work:
cat filename >/dev/null

Which Linux user is running your script?
Try as a user different from root.

Is there enough disk space for creating new files $ARGV[1].bad and $ARGV[1].good ?

hope this helps
 
I would watch the program run and see how memory it is taking up (maybe add some sleeps to slow it down if needed). Most systems (I'm a unix guy so I'm assuming linux has this to) have a limit as to how much memory a user can use and if it a program badly written or has a leak it can max that out.. which normally isn't a problem unless this limit is set abnormally high.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
I had a similar issue running perl on Netware. Turned out to be the cheap-ass motherboard I was using.

Code would crash the test machine but would run fine on a Dell server. Weird.


"We must fall back upon the old axiom that when all other contingencies fail, whatever remains, however improbable, must be the truth." - Sherlock Holmes

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top