summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2016-08-28 10:34:33 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2016-08-28 10:34:33 +0200
commit1bb5446d00b5a8b106470eb54f828ec64503f879 (patch)
treeb30cb89d74b2a2375aa00ff9c8a8a7794231d3d8
parentb81ce4729cff84427bf9283b192dfc0def50a5a7 (diff)
downloadchd_gestion-1bb5446d00b5a8b106470eb54f828ec64503f879.zip
chd_gestion-1bb5446d00b5a8b106470eb54f828ec64503f879.tar.gz
chd_gestion-1bb5446d00b5a8b106470eb54f828ec64503f879.tar.bz2
genconf_prod: helper script remotely used by api/gen_conf.php to put config file in place with some checks
-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
+