Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar-watchdog.sh 2474 2017-12-30 02:00:04Z tom.houdayer $
|
2 |
# $Id: alcasar-watchdog.sh 2516 2018-03-17 16:33:45Z rexy $
|
3 |
|
3 |
|
4 |
# alcasar-watchdog.sh
|
4 |
# alcasar-watchdog.sh
|
5 |
# by Rexy
|
5 |
# by Rexy
|
6 |
# This script is distributed under the Gnu General Public License (GPL)
|
6 |
# This script is distributed under the Gnu General Public License (GPL)
|
7 |
# - Ce script prévient les usagers de l'indisponibilité de l'accès Internet
|
7 |
# - Ce script prévient les usagers de l'indisponibilité de l'accès Internet
|
Line 110... |
Line 110... |
110 |
active_ip=`echo $system |cut -d" " -f2`
|
110 |
active_ip=`echo $system |cut -d" " -f2`
|
111 |
active_session=`echo $system |cut -d" " -f5`
|
111 |
active_session=`echo $system |cut -d" " -f5`
|
112 |
active_mac=`echo $system | cut -d" " -f1`
|
112 |
active_mac=`echo $system | cut -d" " -f1`
|
113 |
active_user=`echo $system |cut -d" " -f6`
|
113 |
active_user=`echo $system |cut -d" " -f6`
|
114 |
# We disconnect inactive user here :
|
114 |
# We disconnect inactive user here :
|
115 |
# We check if this is not an auth @MAC and if he is still connected
|
115 |
# We check if the user isn't an auth @MAC and if he is still connected
|
116 |
if [ "$active_user" != "$active_mac" ] && [ $(expr $active_session) -eq 1 ]; then
|
116 |
if [ "$active_user" != "$active_mac" ] && [ $(expr $active_session) -eq 1 ]; then
|
117 |
if [ -e $current_users_file ]; then
|
117 |
if [ -e $current_users_file ]; then
|
118 |
# We check if user @IP is in 'current_users.txt'
|
118 |
# We check if user @IP is in 'current_users.txt'
|
119 |
cmp_user_ok=$(cat $current_users_file | awk -F':' "\$1 == \"$active_ip\" {print \$2}")
|
119 |
cmp_user_ok=$(cat $current_users_file | awk -F':' "\$1 == \"$active_ip\" {print \$2}")
|
120 |
# If not we disconnect this user.
|
120 |
# If not we disconnect this user.
|