Subversion Repositories ALCASAR

Rev

Rev 1056 | Rev 2044 | 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_IP_BLOCKED="$DIR_CONF/alcasar-ip-blocked"
870 richard 14
ALCASAR_UAMDOMAIN="$DIR_CONF/alcasar-uamdomain"
15
ALCASAR_UAMALLOWED="$DIR_CONF/alcasar-uamallowed"
859 richard 16
ALCASAR_CONF="$DIR_CONF/alcasar.conf"
17
 
18
 
19
# sort file content
870 richard 20
for file in $ALCASAR_SERVICES $ALCASAR_IP_BLOCKED $ALCASAR_UAMDOMAIN $ALCASAR_UAMALLOWED
859 richard 21
do
22
	sort -k2n $file > /tmp/alcasar-tmp-sort
23
	mv -f /tmp/alcasar-tmp-sort $file
24
done
25
 
26
# remove empty lines and put rights
870 richard 27
for file in $ALCASAR_SERVICES $ALCASAR_EXCEPTIONS $ALCASAR_IP_BLOCKED $ALCASAR_CONF $ALCASAR_UAMDOMAIN $ALCASAR_UAMALLOWED
859 richard 28
do
29
	$SED "/^$/d" $file 
30
	chown root:apache $file
31
	chmod 660 $file
32
done