Created
September 17, 2025 12:42
-
-
Save anzz1/a579275655ada57462c8e46db4dbd600 to your computer and use it in GitHub Desktop.
acme-status.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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