coec has asked for the wisdom of the Perl Monks concerning the following question:
At work, we have a very brain dead system whereby our stores (each of which have a unique 4 digit numerical identifier) connect to port on the main AIX cluster for the purpose of getting the latest prices for trade customers. The silly thing about this system is that sockets are not correctly used and many ports are in use on the AIX cluster where, in a perfect world, only one port should be in use.
I have had to write control scripts(start, stop, monitor in ksh as my Perl is not quite up to the task as yet) for this system. The start script:
- starts the binary and tells it which unique port to listen on (50,000 + store number),
- sleep for 2 seconds (cos it fails otherwise), and
- do a 'ps -ef | grep ...' to see if the binary is still around (they have a habbit of dropping out).
I was thinking today that rather than doing a 'ps -ef | grep ...' it would be better to check and see if anything is listening on that port. There are generally 10,000+ processes at any one time so the ps/grep combination is very slow.
I have no idea how to get a Perl script to see if a port has a program bound to it. So a pointer in that direction would be great.
Thanks
CC
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Excuse me, is that port taken?
by clintp (Curate) on Aug 17, 2002 at 15:50 UTC | |
|
Re: Excuse me, is that port taken?
by no_slogan (Deacon) on Aug 17, 2002 at 17:31 UTC |