On Wed, 30 Sep 1998, Matthew Hixson wrote:
> On Wed, 30 Sep 1998, Robert G. Brown wrote:
> > I'm working with Jacek writing my own
> > version of "procd", a daemon that I already have running in alpha that
> > can provide on demand what amounts to a cat of any (permitted) file in
> > /proc, all via a TCP connection without the overhead of a shell. The
> > procd can also lookup or query/build anything accessible in userspace,
> > e.g. it calculates and returns number of users or local time the hard
> > way to avoid shell calls to uptime (I'm trying to leave it
> > unprivileged). I'd be happy to add code to procd to query the CPU
>
> I've also written a little daemon that I call procd. It is a simple
> socket based app that listens for a connection on a specified TCP port.
> You telnet to the port and type the name of the file you want to view. It
> restricts the files you can see to those available from /proc. So if you
> want /proc/cpuinfo that's exactly what you type into your telnet session
> and you get the results right there. There isn't any reason why another
> program couldn't be written to communicate with this one. The output from
> the file requested continues until you see a '.' on a line by itself, much
> like the termination of a DATA segment in SMTP, so it would be easy to
> parse.
> This runs as a nonpriveleged user also, no need for root.
> I don't have this up on the web yet so if anyone would like to see it
> just drop me an email. Its GPL'd, as it should be.
> -M@
This almost exactly describes what I'm doing, except that I plan to add
some authentication and a couple of other commands, and that I do the
actual querying with a perl script rather than telnet. perl parses
anything totally trivially.
Great minds think alike, eh? :-) I'd love to see your source just to see
if I left anything out of mine -- being lazy, I actually send a "done"
to the caller instead of a "." (in perl, just /^done/ which is actually
a bit more readable than /^\./:-) and haven't actually installed the
"send filename" command, but it is next on the agenda, possibly this
very afternoon.
Thanks,
rgb
Robert G. Brown http://www.phy.duke.edu/~rgb/
Duke University Dept. of Physics, Box 90305
Durham, N.C. 27708-0305
Phone: 1-919-660-2567 Fax: 919-660-2525 email:[EMAIL PROTECTED]