Faimond with timestamps
Per Foreby
perf at ddg.lth.se
Fri Aug 3 13:34:10 CEST 2007
Sometimes the faimond output can be confusing. This is especially true
when I'm testing a new configuration, and might install the same
computer many times i a row: Did the installation succeded, or
am I looking at faimond output from an earlier installation?
To make the output more informative, I made a small addition to faimond
to get a timestamp on each line. The patch is included below if someone
is interested.
/Per
--- /usr/sbin/faimond.ORIG 2007-08-03 11:22:53.000000000 +0200
+++ /usr/sbin/faimond 2007-08-03 12:42:01.000000000 +0200
@@ -28,7 +28,7 @@
bind(SERVER, $paddr) or die "bind: $!";
listen(SERVER, SOMAXCONN) or die "listen: $!";
- print "FAI monitoring daemon started on port $port\n";
+ print now(), "FAI monitoring daemon started on port $port\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub big_loop() {
@@ -38,10 +38,16 @@
while ($client_addr = accept(CLIENT, SERVER)) {
$inp = <CLIENT>;
close CLIENT;
- print "$inp";
+ print now(), "$inp";
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+sub now() {
+
+ # Return "H:M:S "
+ sprintf "%02d:%02d:%02d ", (localtime())[2,1,0];
+}
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
server_init;
big_loop;
More information about the linux-fai
mailing list