Subversion Repositories ALCASAR

Rev

Rev 872 | Rev 1056 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
872 richard 1
#!/bin/bash
859 richard 2
 
870 richard 3
# alcasar-file-clean.sh
859 richard 4
# by Rexy
5
# This script is distributed under the Gnu General Public License (GPL)
6
 
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)
9
 
10
SED="/bin/sed -i"
11
DIR_CONF="/usr/local/etc"
12
ALCASAR_SERVICES="$DIR_CONF/alcasar-services"
13
ALCASAR_EXCEPTIONS="$DIR_CONF/alcasar-filter-exceptions"
14
ALCASAR_IP_BLOCKED="$DIR_CONF/alcasar-ip-blocked"
870 richard 15
ALCASAR_UAMDOMAIN="$DIR_CONF/alcasar-uamdomain"
16
ALCASAR_UAMALLOWED="$DIR_CONF/alcasar-uamallowed"
859 richard 17
ALCASAR_CONF="$DIR_CONF/alcasar.conf"
18
 
19
 
20
# sort file content
870 richard 21
for file in $ALCASAR_SERVICES $ALCASAR_IP_BLOCKED $ALCASAR_UAMDOMAIN $ALCASAR_UAMALLOWED
859 richard 22
do
23
	sort -k2n $file > /tmp/alcasar-tmp-sort
24
	mv -f /tmp/alcasar-tmp-sort $file
25
done
26
 
27
# remove empty lines and put rights
870 richard 28
for file in $ALCASAR_SERVICES $ALCASAR_EXCEPTIONS $ALCASAR_IP_BLOCKED $ALCASAR_CONF $ALCASAR_UAMDOMAIN $ALCASAR_UAMALLOWED
859 richard 29
do
30
	$SED "/^$/d" $file 
31
	chown root:apache $file
32
	chmod 660 $file
33
done