summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmisc/genconf_prod21
1 files changed, 21 insertions, 0 deletions
diff --git a/misc/genconf_prod b/misc/genconf_prod
new file mode 100755
index 0000000..27ea25a
--- /dev/null
+++ b/misc/genconf_prod
@@ -0,0 +1,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
+