Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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.
/remote/scm/builds/$arg/Formal/4.0.0.0.29
like above path there are total 4 directories in the path /remote/scm/builds/$arg/FailedFormal
/remote/scm/builds/$arg/Informal
/remote/scm/builds/$arg/FailedInformal
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(4.0.0.29)
#!/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
/remote/scm/builds
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
bash>ls
4.0.0.0.28 4.0.0.0.29 4.0.0.0.30
bash>cd 4.0.0.0.29
bash>ls
build.html build.log
the output i am getting after running the above code is as below
bash>perl prog.pl v_dialer
/vobs/ivr /v_dialer /v_dialermidtier /v_dialerclient /vob1 4.0.0.0.28 4.0.0.0.29 4.0.0.0.30
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....

Comment on How to start automation to open the last three logfiles to get build information
Select or Download Code
Re: How to start automation to open the last three logfiles to get build information
by toolic (Chancellor) on Jul 10, 2007 at 21:20 UTC
    Allow me to pour some ideas...

    Use perltidy to neaten up your code a little.

    Use:

    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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://625886]
Approved by grinder
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (11)
As of 2014-07-14 14:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (262 votes), past polls