aboutsummaryrefslogtreecommitdiff
path: root/acmeman
diff options
context:
space:
mode:
Diffstat (limited to 'acmeman')
-rwxr-xr-xacmeman29
1 files changed, 16 insertions, 13 deletions
diff --git a/acmeman b/acmeman
index 99f158a..e6fee16 100755
--- a/acmeman
+++ b/acmeman
@@ -627,6 +627,20 @@ sub prep_dir {
}
}
+sub runcmd {
+ my $cmd = shift;
+ debug(1, "running $cmd");
+ unless ($dry_run) {
+ system($cmd);
+ if ($? == -1) {
+ error("$cmd: failed to execute: $!");
+ } elsif ($? & 127) {
+ error("$cmd: died on signal ".($? & 127));
+ } elsif (my $code = ($? >> 8)) {
+ error("$cmd: exited with code $code");
+ }
+ }
+}
sub debug_to_loglevel {
my @lev = ('err', 'info', 'debug');
@@ -1185,17 +1199,7 @@ foreach my $vhost (@domlist) {
if ($force || domain_cert_expires($vhost)) {
if (register_domain_certificate($vhost)) {
if (my $cmd = $vhost->postrenew) {
- debug(1, "running $cmd");
- unless ($dry_run) {
- system($cmd);
- if ($? == -1) {
- error("$cmd: failed to execute: $!");
- } elsif ($? & 127) {
- error("$cmd: died on signal ".($? & 127));
- } elsif (my $code = ($? >> 8)) {
- error("$cmd: exited with code $code");
- }
- }
+ runcmd($cmd);
} else {
$renewed++;
}
@@ -1206,8 +1210,7 @@ foreach my $vhost (@domlist) {
if ($renewed) {
if ($config->isset(qw(core postrenew))) {
foreach my $cmd ($config->get(qw(core postrenew))) {
- debug(1, "running $cmd");
- system($cmd) unless $dry_run;
+ runcmd($cmd);
}
} else {
error("certificates changed, but no postrenew command is defined (core.postrenew)");

Return to:

Send suggestions and report system problems to the System administrator.