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.
In reply to marking time during function call by lycanhunter
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |