From 6c20cd561cb2163728be69d264f77680d1d28ec7 Mon Sep 17 00:00:00 2001 From: LecygneNoir Date: Sat, 10 Sep 2016 17:33:49 +0200 Subject: [PATCH] use configuration variables at the beginning of the script --- create-certificat | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/create-certificat b/create-certificat index 98034f5..d17a06f 100644 --- a/create-certificat +++ b/create-certificat @@ -1,5 +1,10 @@ #!/bin/bash +#Configuration variables +certbot_bin="/root/letsencrypt/certbot-auto" +haproxy_pem_path="/etc/haproxy/cert" + + if [ $# -ne 1 ] ; then echo "$(date +%c) Please give domain name as parameter" exit 1 @@ -7,10 +12,10 @@ fi echo "$(date +%c) Generate certificat for ${1}" -/root/letsencrypt/certbot-auto certonly --domains $1 --renew-by-default --http-01-port 63443 --agree-tos +${certbot_bin} certonly --domains $1 --renew-by-default --http-01-port 63443 --agree-tos if [ $? -eq 0 ]; then echo "$(date +%c) Success ! Now creating ${1}.pem" - cat /etc/letsencrypt/live/$1/fullchain.pem /etc/letsencrypt/live/$1/privkey.pem > /etc/haproxy/cert/$1.pem + cat /etc/letsencrypt/live/$1/fullchain.pem /etc/letsencrypt/live/$1/privkey.pem > ${haproxy_pem_path}/$1.pem service haproxy reload else echo "$(date +%c) Error creating certificate with error code $?, exit script..."