(root)/scripts/alcasar-flush_ipset_wl.sh @ 2212 – Rev 1907
Rev 1906 |
Go to most recent revision |
Details |
Compare with Previous |
Last modification |
View Log
Rev |
Author |
Line No. |
Line |
1905 |
raphael.pi |
1 |
#!/bin/sh
|
|
|
2 |
#by Raphaël Pion
|
|
|
3 |
#Permet de vider l'ipset wl_ip_allowed lorsque tous les utilisateurs de la whitelist sont déconnectés
|
|
|
4 |
#Clean wl_ip_allowed ipset when WL users are gone.
|
|
|
5 |
|
|
|
6 |
PTN="(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
|
1906 |
raphael.pi |
7 |
NB_USERS=$(ipset list havp_wl | grep -E $PTN | wc -l)
|
|
|
8 |
if [ $NB_USERS -eq '0' ]
|
1905 |
raphael.pi |
9 |
then
|
1907 |
raphael.pi |
10 |
/sbin/ipset flush wl_ip_allowed
|
1905 |
raphael.pi |
11 |
fi
|