Re: Just create a litle script

Home Page Forums Network Management ZeroShell How to disconnect all users Re: Just create a litle script

#53362

To disconnect all connected users.

On /Database, create a directory named “scripts”.
Inside this create a file named “removeALL” :
$ touch removeALL
$ chmod +x removeALL
$vi removeALL
push insert key

Copy and paste this script inside this file (lines behind Begin / End)


Begin
#!/bin/sh
. /etc/kerbynet.conf
CONFIG=$REGISTER/system/cp
DISCONNECT=$SCRIPTS/cp_disconnect
if ! [ -d $CONFIG/Connected ] ; then
mkdir -p $CONFIG/Connected
fi
cd $CONFIG/Connected
CLIENTS=`ls -d *`
for IP in $CLIENTS ; do
MAC=`cat $IP/MAC 2>/dev/null`
USER=`cat $IP/User 2>/dev/null`
echo “Disconnect $USER $IP $MAC”
. $DISCONNECT $IP
done


End

After push on esc
enter “:wq”

Thats all.
Try it.

You can create a cronjob to put this script running at specific time :

/Database/scripts/removeALL

Kind regards.