Skip to content

Instantly share code, notes, and snippets.

@anzz1
Created September 17, 2025 12:42
Show Gist options
  • Select an option

  • Save anzz1/a579275655ada57462c8e46db4dbd600 to your computer and use it in GitHub Desktop.

Select an option

Save anzz1/a579275655ada57462c8e46db4dbd600 to your computer and use it in GitHub Desktop.
acme-status.sh
#!/bin/bash
# acme-status.sh
# Show status of all acme.sh certificates
ACME_HOME="$HOME/.acme.sh"
if [ ! -d "$ACME_HOME" ]; then
echo "acme.sh home directory not found at $ACME_HOME"
exit 1
fi
printf "%-30s %-30s %-20s %-30s %-30s\n" "Domain" "Certificate" "Status" "Valid From" "Valid To"
echo "-------------------------------------------------------------------------------------------------------------------------------------------"
# Loop through all certificates in acme.sh
for cert in "$ACME_HOME"/*/*.cer; do
[ -e "$cert" ] || continue # skip if no certs
domain=$(basename "$(dirname "$cert")")
# Extract validity info
from=$(openssl x509 -in "$cert" -noout -startdate | cut -d= -f2)
to=$(openssl x509 -in "$cert" -noout -enddate | cut -d= -f2)
# Check if expired
end_epoch=$(date -d "$to" +%s)
now_epoch=$(date +%s)
if [ $now_epoch -gt $end_epoch ]; then
status="EXPIRED"
else
status="VALID"
fi
printf "%-30s %-30s %-20s %-30s %-30s\n" "$domain" "$(basename "$cert")" "$status" "$from" "$to"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment