I've got multiple services running on consecutive ports (listening on them) in urestricted range (1024+). From time to time I need to restart those services and it happens that one of services is using port of other service as local port to connect to database. In a result other service complains about not being able to listen on now-busy-port. I need to manually determine service with netstat to force port change by restarting this very service so port is now free to use by rightfull other service.
Is there any method to prevent port from being used as opening and allowing it to be opened in listen mode only?
System: Linux
Currently using port range from 9000-9100