Subversion Repositories ALCASAR

Rev

Rev 870 | Go to most recent revision | Details | Last modification | View Log

Rev Author Line No. Line
859 richard 1
#/bin/bash
2
 
3
# alcasar-nf.sh
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"
15
ALCASAR_CONF="$DIR_CONF/alcasar.conf"
16
 
17
 
18
# sort file content
19
for file in $ALCASAR_SERVICES $ALCASAR_IP_BLOCKED
20
do
21
        sort -k2n $file > /tmp/alcasar-tmp-sort
22
        mv -f /tmp/alcasar-tmp-sort $file
23
done
24
 
25
# remove empty lines and put rights
26
for file in $ALCASAR_SERVICES $ALCASAR_EXCEPTIONS $ALCASAR_IP_BLOCKED $ALCASAR_CONF
27
do
28
        echo $file
29
        $SED "/^$/d" $file
30
        chown root:apache $file
31
        chmod 660 $file
32
done