We're running a 3rd party TTY service on our servers, to support some thin clients manufactured by the 3rd party.
From time to time, connection to a thin client can get locked up. Procedure is to stop the TTY service, wait for connections to close, start the TTY service. Additionally on CentOS 4.x servers the command init q
Normally we do this manually like this, from root.
service axtty stop
Stop the service
netstat -d | grep axel
Run and monitor the netstat command until all connections are closed, ie. No lines containing axel
.
service axtty start
Start the service
Is there a way to sum all that up in a single automated shell script (bash)?
Servers are CentOS 4.x or 6.x