Subversion Repositories ALCASAR

Rev

Rev 2887 | Rev 3008 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2887 Rev 2967
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-watchdog.sh 2887 2020-11-26 22:08:42Z rexy $
2
# $Id: alcasar-watchdog.sh 2967 2021-07-08 09:47:39Z 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 117... Line 117...
117
usage="Usage: alcasar-watchdog.sh {-lt --lan_test | --disconnect-permanent-users}"
117
usage="Usage: alcasar-watchdog.sh {-lt --lan_test | --disconnect-permanent-users}"
118
case $1 in
118
case $1 in
119
	-\? | -h* | --h*)
119
	-\? | -h* | --h*)
120
		echo "$usage"
120
		echo "$usage"
121
		exit 0
121
		exit 0
122
		;;
122
	;;
123
	-lt | --lan_test)
123
	-lt | --lan_test)
124
		lan_test
124
		lan_test
125
		exit 0
125
		exit 0
126
		;;
126
	;;
127
	--disconnect-permanent-users)
127
	--disconnect-permanent-users)
128
        	/bin/sed -i '/PERM/d' $current_users_file
128
		/bin/sed -i '/PERM/d' $current_users_file
129
        	exit 0
129
		exit 0
130
        	;;
130
	;;
131
	*)
131
	*)
132
		lan_test
132
		lan_test
133
		# We disconnect inactive users (its means that their 'status.php' tab has been closed --> their ip address isn't in $current_users_file)
133
		# We disconnect inactive users (its means that their 'status.php' tab has been closed --> their ip address isn't in $current_users_file)
134
		# process each equipment known by chilli
134
		# process each equipment known by chilli
135
		for system in `/usr/sbin/chilli_query list | grep -v "0\.0\.0\.0"`
135
		for system in `/usr/sbin/chilli_query list | grep -v "0\.0\.0\.0"`
Line 169... Line 169...
169
					/usr/sbin/chilli_query logout $active_mac
169
					/usr/sbin/chilli_query logout $active_mac
170
					chmod 644 /var/Save/security/watchdog.log
170
					chmod 644 /var/Save/security/watchdog.log
171
				fi
171
				fi
172
			fi
172
			fi
173
		done
173
		done
174
		;;
174
	;;
175
esac
175
esac
176
IFS=$OLDIFS
176
IFS=$OLDIFS