lycanhunter has asked for the wisdom of the Perl Monks concerning the following question:
my $outfile = "> /home/vobadmin/scripts/CC_mass_protect_element_log.tx +t"; open (OUTFILE,$outfile); timestamp(); # #### Get list of components from specific vob # my @voblist = `cat /home/vobadmin/scripts/voblist.txt`; foreach my $i (@voblist) { chomp($i); my $vob = "\/vobs\/$i"; chomp($vob); print '[' . timestamp() . '] Start Time'. "\n"; print OUTFILE '[' . timestamp() . '] Start Time'. "\n"; print "VOB is: $vob\n"; chdir $vob; print "Loading Array with all elements from vob: $vob\n"; my @element = `cleartool find \. \-all \-print`; my @complist = `ls $vob`; foreach my $comp (@complist) { chomp ($comp); if ($comp ne "lost\+found") { my $comppath = "$vob\/$comp"; chomp($comppath); print OUTFILE "COMPONENT IS: $comppath\n"; my $group = `cleartool desc -fmt \"%[group]p\" $comppath`; print "Getting Group for Comp: $group\n"; #print "Change Directory to Comp: $comppath\n"; #chdir $comppath; my @matches = grep {/$comppath/} @element; $comp_counter = 0; foreach my $elem (@matches) { chomp($elem); #print " Execute: $elem\n"; print "Running Command \`cleartool protect -chown vobad +min -chgrp $group -chmod 775 $elem\`\n"; my $result = `cleartool protect \-chown vobadmin \-chgr +p $group \-chmod 775 \"$elem\"`; print "\|\-\-\-\-\> $result\n"; $comp_counter++; } print OUTFILE "-----Total Elements for $comppath is: $comp +_counter\n"; } else { print "$comp is not component skipping\n"; next; } print '[' . timestamp() . ']: End Time'. "\n"; print OUTFILE '[' . timestamp() . '] End Time'. "\n"; } } sub timestamp { return localtime (time); } close OUTFILE;
During this moment my @element = `cleartool find \. \-all \-print`; which takes up to 25 minutes to gather all the elements I want to be able to show a progress or alive status on screen (dots, spinning pipe, etc..) to let user know the script is actually running.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: marking time during function call
by kcott (Archbishop) on Jun 17, 2015 at 03:06 UTC | |
|
Re: marking time during function call
by Laurent_R (Canon) on Jun 16, 2015 at 21:34 UTC | |
|
Re: marking time during function call
by stevieb (Canon) on Jun 16, 2015 at 20:41 UTC | |
|
Re: marking time during function call
by neilwatson (Priest) on Jun 16, 2015 at 17:50 UTC | |
|
Re: marking time during function call
by afoken (Chancellor) on Jun 17, 2015 at 07:28 UTC | |
|
Re: marking time during function call
by Hosen1989 (Scribe) on Jun 16, 2015 at 19:08 UTC | |
|
Re: marking time during function call
by QM (Parson) on Jun 17, 2015 at 10:30 UTC | |
by lycanhunter (Initiate) on Jun 17, 2015 at 17:38 UTC | |
by lycanhunter (Initiate) on Jun 17, 2015 at 15:19 UTC | |
by QM (Parson) on Jun 17, 2015 at 16:00 UTC | |
by lycanhunter (Initiate) on Jun 17, 2015 at 16:42 UTC |