wmclockmon: update change-log
[dockapps.git] / wmjiface / src / svr.client / cattheprocinfo
blob90060cc1e8288d07ac8fb42a360772405125d1b6
1 #!/usr/bin/perl
3 use IO::Socket;
5 $port = 7654;
7 ## This could really do anything you want...
8 sub print_stuff {
9 open in, "/proc/net/dev";
10 while(<in>) {
11 print $client "$_" if /eth[01]:/ or /ppp[01]:/;
13 close in;
17 ## Run the farqin thing:
18 $bn = `basename $0`;
19 `killall -v -q -1 $bn`;
21 if (fork) {
22 print "Forkin away...\n";
23 exit 0;
24 } else {
25 $0 = "$bn [$port]";
26 &open_it;
27 &listen_to_it;
30 sub open_it {
31 $sock = new IO::Socket::INET (
32 LocalPort => "$port",
33 Proto => tcp,
34 Reuse => 1,
35 Listen => 1
36 ) or die "Could not create socket: $!\n";
39 sub listen_to_it {
40 while($client = $sock->accept) {
41 &print_stuff;
42 shutdown $client, 2;