Subversion Repositories ALCASAR

Rev

Rev 2886 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2886 Rev 2887
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-watchdog.sh 2886 2020-11-23 22:50:01Z rexy $
2
# $Id: alcasar-watchdog.sh 2887 2020-11-26 22:08:42Z 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 112... Line 112...
112
                        $IPTABLES -D PREROUTING -t nat -i $TUNIF -p udp --dport domain -j REDIRECT --to-port 56
112
                        $IPTABLES -D PREROUTING -t nat -i $TUNIF -p udp --dport domain -j REDIRECT --to-port 56
113
                fi
113
                fi
114
        fi
114
        fi
115
}
115
}
116
 
116
 
117
usage="Usage: alcasar-watchdog.sh {-lt --lan_test}"
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"`