Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

How to start automation to open the last three logfiles to get build information

by perladdict (Chaplain)
on Jul 10, 2007 at 17:38 UTC ( #625886=perlquestion: print w/replies, xml ) Need Help??
perladdict has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,
I am working on a task to automate the build system logfiles
the fallowing are the directory structure that i have to navigate to get the log files.
like above path there are total 4 directories in the path /remote/scm/builds/$arg/FailedFormal
Each of the end directory represents Build release number, logfile for that release is in that directory.
First i am trying for Formal builds,it contains more then 10 release amnog them i have to get only the last three relese log files to get the status information from
logfiles.Below is the code i am trying but i unable to change the directory path to the release directory(
#!/usr/bin/perl $arg=$ARGV[0]; &navigate; &asd; sub navigate { @vobtag=`cut -d ";" -f1 conffile.txt`; print "@vobtag\n"; } sub asd { $arg=$ARGV[0]; $path="/remote/scm/builds/$arg/Formal"; chdir($path); @array=`ls `; print @array; }
Here conffile.txt is the input for the script the format of this file is as below
/vobs/ivr;IR:IVR;IVR;Interactive Response /v_dialer;APC:Dialer;APC;Avaya Proactive Contact /v_dialermidtier;APC:Supervisor;APC;Avaya Proactive Contact /v_dialerclient;APC:Agent;APC;Avaya Proactive Contact /vob1;SBL;Siebel;Siebel
First field from this file is an argument to the script
the directory structure is as below
bash> ls /remote/scm/builds
bt coreservices cs_licgen HCC IVRD ivr_vw_win v_dialer v_dialermidtier vob1 IVRD
bash>cd v_dialer
bash>cd Formal
build.html build.log
the output i am getting after running the above code is as below
bash>perl v_dialer
/vobs/ivr /v_dialer /v_dialermidtier /v_dialerclient /vob1
Can any one help me out to navigate up to the log file of the relese directory...
The main objective of this task is to get the last three relese log files for a specific product to find the staus information.
This problem seems to easy for expert monks but for me i am not getting any ideas how to start.
Keeps pouring your ideas....

Replies are listed 'Best First'.
Re: How to start automation to open the last three logfiles to get build information
by toolic (Bishop) on Jul 10, 2007 at 21:20 UTC
    Allow me to pour some ideas...

    Use perltidy to neaten up your code a little.


    use warnings; use strict;

    Is it really necessary to cd to any of these directories? If you just need to read in specific files, you can use the full path to the file.

    Are the "last 3 files" based on a numeric string in the filename, or are they based on the file's timestamp?

    You only need $arg=$ARGV[0]; once.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://625886]
Approved by grinder
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2018-06-19 02:36 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (111 votes). Check out past polls.