Clear Station All

0 Likes

If you need to restart an OES Linux Server, every active connection gets a broadcast message like "File server SERVERNAME is down. Connection terminated."


Because the Novell Client has an auto reconnect function, sometimes you don't want your Users to get this annoying broadcast message.



On NetWare 6.x you can easily do a "clear station all" before you start the Server. In OES Linux there seems to be no such function.
From the support forums I know that many people search for a solution in this situation.


SOLUTION:


You can use Remote Manager ( https://Servername-or-ip:8009 ) - Manage NCP Services - Manage Connections to see all active connections.


Here you can also "Clear ALL marked connections".


If you clear them, and then restart the server, there will be no broadcasts. But this is circuitous, and a very annoying job to mark many
connections.



So I tried to get a solution on the command line:



With ncpcon you can manage your ncp connection on the Linux Server console.
* "ncpcon connection" gives you an overview.

* "ncpcon connection 7" shows infos about one specific connection.


With the "Trial an Error Method" i found, that with
* "ncpcon connection clear 7" you can clear this specific connection!


hmm... It does not seem to be very well documented...



But you still have the problem that you have to choose every connection one by one.

So I wrote the following little Shell Script, that will do the Job for you.



Lets call it "clearStationAll" and chmod 755 it. (or tar -zxvf clearStationAll.tar if you downloaded the tool)



Now you can call ./clearStationAll and then reboot your Server (init 6). Your Users will get no message. In very rare situations it could happen, that the Client auto-reconnects to the server, before it goes down. Then he will get the message again.



For this reason you can call the Script like:

* "./clearStationAll disable"


Now all connections on the Server get cleared, and new logins will be disabled (ncpcon disable login). Be careful, only fully patched OES
Servers will allow to disable logins.



EXAMPLE:
###############################################################
#/bin/bash
# description: clear all connection on OES Linux Server
# author: Olaf Zerfowski
# version: 0.01
# date: 12-07-2006

maxcon=`ncpcon connection 2>/dev/null| sed -ne "s/.*Connection Slots
Allocated\t//pg"`

count=0

if [ "$1" == "disable" ]
then
disable=`ncpcon disable login 2>/dev/NULL`
if echo $disable | grep "Login is now disabled" 1>/dev/null 2>&1
then
echo $disable
echo dont forget to 'ncpcon enable login' if you dont bounce your
server
else
echo 'ncpcon disable login' is not supported... hurry up to
bounce the server...
fi
fi

echo "Max Connections=$maxcon"

while [ $count -le $maxcon ]
do
ncpcon connection clear $count 1>/dev/null 2>&1
count=`expr $count 1`
done
echo All connections are cleared.

#########################################################################


ENVIRONMENT:



Tested on OES Linux SP2

Labels:

Collateral
Comment List
Anonymous
Related Discussions
Recommended