From 89c7daa75a9e67eaaf36fb17d8498de64e71e359 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 24 Jan 2016 12:49:01 +0100 Subject: restore from backup on simp_le fail --- custom/simp_le.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/custom/simp_le.nix b/custom/simp_le.nix index 45d7a5ca..94adb44d 100644 --- a/custom/simp_le.nix +++ b/custom/simp_le.nix @@ -8,18 +8,19 @@ domain: let script = writeText "${domain}.sh" '' + backupDir=/root/ssl_archive/$(date +'%Y-%m-%d')-${domain} mkdir -p ${dir} cd ${dir} - mkdir -p /root/ssl_archive/$(date +'%Y-%m-%d')-${domain} + mkdir -p $backupDir for f in account_key.json cert.pem fullchain.pem key.pem privkey.pem; do - [[ -e $f ]] && mv $f /root/ssl_archive/$(date +'%Y-%m-%d')-${domain} + [[ -e $f ]] && mv $f $backupDir done ${simp_le}/bin/simp_le -d ${domain}:/srv/www/acme/${domain}/ \ --email "phikeebaogobaegh@141.li" \ -f account_key.json \ -f cert.pem \ -f fullchain.pem \ - -f key.pem + -f key.pem || { rm *; mv $backupDir/* . && rmdir $backupDir } [[ -e key.pem ]] && ln -s -f key.pem privkey.pem ''; in -- cgit v1.2.3