Subversion Repositories ALCASAR

Rev

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

Rev 859 Rev 870
Line 1... Line 1...
1
#/bin/bash
1
#/bin/bash
2
 
2
 
3
# alcasar-nf.sh
3
# alcasar-file-clean.sh
4
# by Rexy
4
# by Rexy
5
# This script is distributed under the Gnu General Public License (GPL)
5
# This script is distributed under the Gnu General Public License (GPL)
6
 
6
 
7
# clean alcasar conf files (remove empty lines, sort and control)
7
# clean alcasar conf files (remove empty lines, sort and control)
8
# nettoie les fichiers de conf d'alcasar (suppression des lignes vides, tri et contrĂ´le)
8
# nettoie les fichiers de conf d'alcasar (suppression des lignes vides, tri et contrĂ´le)
Line 10... Line 10...
10
SED="/bin/sed -i"
10
SED="/bin/sed -i"
11
DIR_CONF="/usr/local/etc"
11
DIR_CONF="/usr/local/etc"
12
ALCASAR_SERVICES="$DIR_CONF/alcasar-services"
12
ALCASAR_SERVICES="$DIR_CONF/alcasar-services"
13
ALCASAR_EXCEPTIONS="$DIR_CONF/alcasar-filter-exceptions"
13
ALCASAR_EXCEPTIONS="$DIR_CONF/alcasar-filter-exceptions"
14
ALCASAR_IP_BLOCKED="$DIR_CONF/alcasar-ip-blocked"
14
ALCASAR_IP_BLOCKED="$DIR_CONF/alcasar-ip-blocked"
-
 
15
ALCASAR_UAMDOMAIN="$DIR_CONF/alcasar-uamdomain"
-
 
16
ALCASAR_UAMALLOWED="$DIR_CONF/alcasar-uamallowed"
15
ALCASAR_CONF="$DIR_CONF/alcasar.conf"
17
ALCASAR_CONF="$DIR_CONF/alcasar.conf"
16
 
18
 
17
 
19
 
18
# sort file content
20
# sort file content
19
for file in $ALCASAR_SERVICES $ALCASAR_IP_BLOCKED
21
for file in $ALCASAR_SERVICES $ALCASAR_IP_BLOCKED $ALCASAR_UAMDOMAIN $ALCASAR_UAMALLOWED
20
do
22
do
21
	sort -k2n $file > /tmp/alcasar-tmp-sort
23
	sort -k2n $file > /tmp/alcasar-tmp-sort
22
	mv -f /tmp/alcasar-tmp-sort $file
24
	mv -f /tmp/alcasar-tmp-sort $file
23
done
25
done
24
 
26
 
25
# remove empty lines and put rights
27
# remove empty lines and put rights
26
for file in $ALCASAR_SERVICES $ALCASAR_EXCEPTIONS $ALCASAR_IP_BLOCKED $ALCASAR_CONF
28
for file in $ALCASAR_SERVICES $ALCASAR_EXCEPTIONS $ALCASAR_IP_BLOCKED $ALCASAR_CONF $ALCASAR_UAMDOMAIN $ALCASAR_UAMALLOWED
27
do
29
do
28
	echo $file
-
 
29
	$SED "/^$/d" $file 
30
	$SED "/^$/d" $file 
30
	chown root:apache $file
31
	chown root:apache $file
31
	chmod 660 $file
32
	chmod 660 $file
32
done
33
done