blob: 27ea25ac50e8cc71b8ea2056c37cfb206d91a73c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#!/bin/bash
cat > /root/config_svc.new.conf
[ -f /root/config_svc.conf ] && mv /root/config_svc.conf /root/config_svc.bkp.conf
new=$(wc -l /root/config_svc.new.conf | cut -d ' ' -f 1)
[ -f /root/config_svc.bkp.conf ] || touch /root/config_svc.bkp.conf
bkp=$(wc -l /root/config_svc.bkp.conf | cut -d ' ' -f 1)
diff=$((new-bkp))
sq=$((diff*diff))
if [ $new -gt 0 -a $bkp -gt 0 -a $sq -lt 1024 ]
then mv /root/config_svc.new.conf /root/config_svc.conf
echo "Config mise à jour"
else
echo "Oulà, trop de choses a appliquer d'un coup, je refuse (oui je suis lâche)" >&2
exit 1
fi
/root/setup_routing.sh
|