diff options
-rw-r--r-- | custom/simp_le.nix | 7 |
1 files 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: | |||
8 | 8 | ||
9 | let | 9 | let |
10 | script = writeText "${domain}.sh" '' | 10 | script = writeText "${domain}.sh" '' |
11 | backupDir=/root/ssl_archive/$(date +'%Y-%m-%d')-${domain} | ||
11 | mkdir -p ${dir} | 12 | mkdir -p ${dir} |
12 | cd ${dir} | 13 | cd ${dir} |
13 | mkdir -p /root/ssl_archive/$(date +'%Y-%m-%d')-${domain} | 14 | mkdir -p $backupDir |
14 | for f in account_key.json cert.pem fullchain.pem key.pem privkey.pem; do | 15 | for f in account_key.json cert.pem fullchain.pem key.pem privkey.pem; do |
15 | [[ -e $f ]] && mv $f /root/ssl_archive/$(date +'%Y-%m-%d')-${domain} | 16 | [[ -e $f ]] && mv $f $backupDir |
16 | done | 17 | done |
17 | ${simp_le}/bin/simp_le -d ${domain}:/srv/www/acme/${domain}/ \ | 18 | ${simp_le}/bin/simp_le -d ${domain}:/srv/www/acme/${domain}/ \ |
18 | --email "phikeebaogobaegh@141.li" \ | 19 | --email "phikeebaogobaegh@141.li" \ |
19 | -f account_key.json \ | 20 | -f account_key.json \ |
20 | -f cert.pem \ | 21 | -f cert.pem \ |
21 | -f fullchain.pem \ | 22 | -f fullchain.pem \ |
22 | -f key.pem | 23 | -f key.pem || { rm *; mv $backupDir/* . && rmdir $backupDir } |
23 | [[ -e key.pem ]] && ln -s -f key.pem privkey.pem | 24 | [[ -e key.pem ]] && ln -s -f key.pem privkey.pem |
24 | ''; | 25 | ''; |
25 | in | 26 | in |