Kevin Miller
|
Extracting an IP address from an inetd task instance
|
Kevin Miller
01/07/2010 2:18 PM
post44750
|
Extracting an IP address from an inetd task instance
I want inetd to run a script when a socket service is connected. The script will log the start of the connection, run
the service, and then log the end of the connection, like this:
logger start service
service args
logger end service
I would like to include the IP address of the other end of the socket in the log entry. What might be a simple way to
extract this information from stdin when this script is run? Right now I am doing something like
who=netstat -a | grep service
This works, but I was wondering if there was something I could do, perhaps in C, that would do something similar and
cleaner.
Thanks,
Kevin
|
|
|