#!/usr/bin/perl
# tta_status.cgi
# Display Status de los Services with Tarantella.
# STTA Rev. 1.3 Copyright (c) 2001-2004 Jesús Pérez Lorenzo  --- license GNU GPL 
# stta: (@#) 1.31051043346- [2004_01_29_102036]

 require './stta-lib.pl';
 &foreign_require("proc", "proc-lib.pl");

 &headerstta($text{'index_ttastatus'}, "", "ttastatus",undef,1,0,"$text{'headpage_right'}"."$text{'head_logout'}",undef,undef,"$text{head_below}" );
 print "<hr><p>\n"; 
 print "<table width=100% border>\n";
 print "<tr $tb> <td><font color='$revtext'><b>$text{'titidx_ttastatus'}</b></td> </tr>\n";
 print "<tr $cb> <td><table width=100%>\n";
 print "<tr><td><pre>\n";
       print "<pre>\n";
        $config{'output_cgis'}=1;
        $type_cmd="status";
        $str=$config{'tta_status'};


     @line=split(/\//, $config{'tta_daemon'}, -1);
     $daemonStr=$line[$#line];
     @procs = &foreign_call("proc", "list_processes");
     @pidlist=&get_processes_list($daemonStr,1,1);
     @pidlist = grep { $_->{'args'} =~ /\Q$daemonStr\E/i } @procs;

      if ( $str eq "" ) {
           print "<b>$text{'index_cmderr'}</b>\n"; 
      } elsif ( $#pidlist < 0 ) {
           print "<center>\n"; 
           &out_tabserv_chk();
           print "</center>\n"; 
      } elsif ( $#pidlist > 0 ) {
           &run_tta_cmd($str,$type_cmd);
           print "</pre>\n";
           print "<tr><d><center><b>-- oOo --</b></center></td></tr>\n";
           print "<tr><td><center>".&text('viewlog_action',$stta_sid)."</td></tr>"; 
      }
 print "</table></table><p>\n";
 &footer($config{'back_return'},$text{'index'});
 do "footer.pl";
 exit;



