Skip to content

Commit e1ac2b0

Browse files
author
Thom Pol
committed
Backup Let's Encrypt certificates on update (#6281)
1 parent 9954d8f commit e1ac2b0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

install/update.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,17 @@
216216
exec("tar pcfz $backup_path/etc.tar.gz /etc 2> /dev/null", $out, $returnvar);
217217
if($returnvar != 0) die("Backup failed. We stop here...\n");
218218

219+
if (is_dir('/root/.acme.sh')) {
220+
swriteln('Creating backup of "/root/.acme.sh" directory...');
221+
exec("tar pcfz $backup_path/acme.sh.tar.gz /root/.acme.sh 2> /dev/null", $out, $returnvar);
222+
if($returnvar != 0) die("Backup failed. We stop here...\n");
223+
} elseif (is_dir('/etc/letsencrypt')) {
224+
swriteln('Creating backup of "/etc/letsencrypt" directory...');
225+
exec("tar pcfz $backup_path/letsencrypt.tar.gz /etc/letsencrypt 2> /dev/null", $out, $returnvar);
226+
if($returnvar != 0) die("Backup failed. We stop here...\n");
227+
}
228+
229+
219230
exec("chown root:root $backup_path/*.tar.gz");
220231
exec("chmod 700 $backup_path/*.tar.gz");
221232
}

0 commit comments

Comments
 (0)