tcl-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@dedasys.com (David N. Welton)
Subject Re: problems with child processes
Date Sun, 30 Jun 2002 14:16:39 GMT
"Paul Buhr" <pbuhr@vision-systems.de> writes:

Hi - I'm not sure which Apache Tcl product you are using...  I'll
assume mod_dtcl, though.  You should follow up to that list.

> I wrote a tcl-Skript, what runs command-line processes to get
> informations which are used. Sometime it works, sometimes it
> crashes.  When it crashes, I get the following error:
 
>  5:44pm  up 2 days,  9:28,  0 users,  load average: 0.05, 0.06, 0.08
> error waiting for process to exit: child process lost (is SIGCHLD
> ignored or trapped?)
>     while executing
> "exec uptime"

> followed by the code of the script. When I run the script using
> tclsh, I never receive an error message like this... what do I
> wrong?

I bet it's one of these other exec's...
 
Try putting each one on its own page, and seeing if they work.  This
will help you figure out which one is broken, or having trouble.

Another way to make sure that the page at least doesn't break is to
make use of the 'catch' command.

> set mem [exec free | grep "Mem"]

If I were you, I might consider making a Tcl interface to libproc, and
then just call that from Tcl.  It would be more efficient.

This is probably better done in a style like this:

set HTML {

<lots of html> ....

%s ... %d %d

}

puts [format $HTML $variableone $hostname $mem $blah $blah $blah]

Or just use the template facilities of mod_dtcl:

<html>
<blah>
<blah>
<blah>
<? puts $hostname ?>
<blah>
<blah>
<blah>

Either one of those is more efficient than a huge amount of puts
statements:

> puts "<HTML><HEAD>"
> puts "<TITLE>System-Monitor</TITLE>"
> puts "<META HTTP-EQUIX=\"REFRESH\" CONTENT=\"60\">"
> puts "</HEAD><BODY BGCOLOR=\"#1929FF\" TEXT=\"#FFFF00\" FACE=\"COURIER\">"
> puts "<B><U>Hostname:</U></B> $thishost<BR>"
> puts "<B><U>durchschnittliche CPU-Last:</U></B> $last<BR>"
> puts "<BR><BR><BR>"
> puts "<FONT COLOR=\"#FFFFFF\"><H2>Speicherauslastung</H2></FONT>"
> puts "<TABLE BORDER=\"2\" BORDERCOLOR=\"#1111EE\" BGCOLOR=\"#800000\">"
> puts "<TR>"
> puts "<TD BGCOLOR=\"#008000\"><B><I>Speichertyp</I></B></TD>"
> puts "<TD BGCOLOR=\"#008000\"><B><I>gesamt</I></B></TD>"
> puts "<TD BGCOLOR=\"#008000\"><B><I>belegt</I></B></TD>"
> puts "<TD BGCOLOR=\"#008000\"><B><I>frei</I></B></TD>"
> puts "</TR>"
> puts "<TR>"
> puts "<TD BGCOLOR=\"#000080\"><FONT
> COLOR=\"#FFFFFF\">psysikalisch</FONT></TD>"
> puts "<TD>$totalmem</TD>"
> puts "<TD>$usedmem</TD>"
> puts "<TD>$freemem</TD>"
> puts "</TR>"
> puts "<TR>"
> puts "<TD BGCOLOR=\"#000080\"><FONT
> COLOR=\"#FFFFFF\">Auslagerung</FONT></TD>"
> puts "<TD>$totalswap</TD>"
> puts "<TD>$usedswap</TD>"
> puts "<TD>$freeswap</TD>"
> puts "</TR>"
> puts "</TABLE>"
> puts "<BR><BR><BR>"
> puts "<FONT COLOR=\"#FFFFFF\"><H2>Prozessorinformation</H2></FONT>"
> puts "<TABLE BORDER=\"0\" BGCOLOR=\"#FFFF00\"><TR><TD><FONT
> COLOR=\"#000000\"><PRE>$procinfo</PRE></FONT></TD></TR></TABLE>"
> puts "<BR><BR><BR>"
> puts "<FONT COLOR=\"#FFFFFF\"><H2>Massenspeicher</H2></FONT>"

Good luck, and let me know if it works,
-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@tcl.apache.org
For additional commands, e-mail: general-help@tcl.apache.org


Mime
View raw message