              }
              $lnumHost++;
  	      if ( $debug eq 2 ) { print DebugLog "$HostPath[0] -- $HostPath[1] \n"; }
          }
          if ( $HostPath[1].length eq 0 ) {
               $NameHost=$HostPath[0];
          } else {
               $NameHost=$HostPath[1];
          }
          if ( $NameHostGrp.length eq 0 ) {
               # TTA does not set equal TTA_HostName and TTA_ApplicationName  ENV 
	       # in TTA_HostName will have only a word with the "host-address"(ip orname)
               # From STTA vers. 1.2 host-address is in "list_host" file records
	       # it is enforced to be unique ... so NameHostGrp and NameHost can be ...
               foreach $item (&list_hosts()) {
                       if ( $item->{'ipname'} eq $NameHost ) {
                          $Name_Host=$item->{'ens'};
                          $GrpHostAlias=$item->{'grpalias'};
                          last;
                       }
               }
               foreach $item (&list_grphosts()) {
                       if ( $item->{'alias'} eq $GrpHostAlias ) {
                          $NameHostGrp=$item->{'ens'};
                          last;
                       }
               }
               $NameHost=$Name_Host; 

               # this was an idyllic situation where Apps and Hosts Trees are identicals 
               # $NameHostGrp=$NameAppGrp;
               # $NameHostGrp=~s/RIMA/servidores/g;
          }
  	  if ( $debug eq 2 ) { print DebugLog "\n";}
}

sub write_countsess 
{
           &lock_file($config{'cron_sessout_file'});
           open(COUNTSESSFILE, ">$config{'cron_sessout_file'}");
              foreach $countsess (@count_sess) { 
                        $lin_countsess=$countsess->{'alias'}."::".$countsess->{'name'}."::".$countsess->{'obj'}."::".$countsess->{'objalias'}."::".$countsess->{'grpalias'}."::".$countsess->{'num'}."::\n";
                        print FILEHOSTS "$lin_hosts";
                   }
                   print COUNTSESSFILE "$lin_countsess\n";
              }
           close (COUNTSESSFILE);
           $str=$text{'user_made'}." ->  CountSESS";
           &additional_log('count_sess', undef, $str);
           &webmin_log($config{'cron_sessout_file'}, undef, "update");
           &unlock_file($config{'cron_sessout_file'});
}
1;  # Return true
