Subversion Repositories ALCASAR

Rev

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

Rev 2956 Rev 2960
Line 35... Line 35...
35
else
35
else
36
	args=$1
36
	args=$1
37
fi
37
fi
38
 
38
 
39
case $args in
39
case $args in
40
	--save)
40
	--save)	# save all the IP before changing the configuration
41
		rm -f $TMP_ip_gw_save
41
		rm -f $TMP_ip_gw_save
42
		# ipset name list for load_balancing
42
		gw_list="gw0"	# ipset name list for load_balancing
43
		gw_list="gw0"
-
 
44
		for ((i=1 ; i<=$nb_gw ; i++)); do
43
		for ((i=1 ; i<=$nb_gw ; i++)); do
45
			gw_list="${gw_list} gw$i"
44
			gw_list="${gw_list} gw$i"
46
		done
45
		done
47
		# Saving all of the already connected IP in order to put them back in the load balancing after
46
		# Saving all of the already connected IP in order to put them back in the load balancing after
48
		for i in $gw_list;do
47
		for i in $gw_list;do
49
			ipset list $i 1>/dev/null 2>&1
48
			ipset list $i 1>/dev/null 2>&1
50
			if [ $? -eq 0 ]
49
			if [ $? -eq 0 ]
51
			then
50
			then
52
				# the cut -d":" -f5 deletes all the lines with a :, i.e all the lines except the members
51
				# the cut -d":" -f5 deletes all the lines with a :, i.e all the lines except the members
53
				ipset list $i | cut -d":" -f5 | sed '/^[[:space:]]*$/d' >> $TMP_ip_gw_save
52
				ipset list $i | grep -v ":" >> $TMP_ip_gw_save
54
			fi
53
			fi
55
		done
54
		done
56
	exit 0
55
	exit 0
57
	;;
56
	;;
58
	--apply)
57
	--apply)