Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

Rev Author Line No. Line
672 richard 1
#/bin/bash
493 franck 2
# $Id: alcasar-qos.sh 1258 2013-12-04 21:51:29Z franck $
3
 
672 richard 4
# alcasar-CA.sh
5
# by Franck BOUIJOUX
6
# This script is distributed under the Gnu General Public License (GPL)
493 franck 7
 
672 richard 8
# Active / désactive la qualite de service réseau
9
# Enable / disable QOS
10
 
493 franck 11
SED="/bin/sed -i"
12
FIC_QOS="/usr/local/etc/alcasar-iptables-qos.sh"
13
 
14
usage="Usage: alcasar-qos.sh {--on or -on} | {--off | -off} "
15
nb_args=$#
16
args=$1
17
if [ $nb_args -eq 0 ]
18
then
19
	nb_args=1
20
	args="-h"
21
fi
22
case $args in
23
	-\? | -h* | --h*)
24
		echo "$usage"
25
		exit 0
26
		;;
27
	--on|-on)	
28
		# activation du filtrage réseau
1258 franck 29
		if [ -e $FIC_QOS ] 
30
		then 
31
			$SED "s?^QOS.*?QOS=\"on\"?g" /usr/local/bin/alcasar-iptables.sh
32
			/usr/local/bin/alcasar-iptables.sh
493 franck 33
		else	
34
			exit 2
35
		fi
36
		;;
37
	--off|-off)
38
		# désactivation du filtrage réseau
1258 franck 39
		$SED "s?^QOS.*?QOS=\"off\"?g" /usr/local/bin/alcasar-iptables.sh
493 franck 40
		/usr/local/bin/alcasar-iptables.sh
41
		;;
42
	*)
43
		echo "Argument inconnu :$1";
44
		echo "$usage"
45
		exit 1
46
		;;
47
esac
48