#!/bin/bash RED="\e[31m" ENDCOLOR="\e[0m" for file in ./nginx/sites-available/*.conf; do domain=$(basename "$file" .conf | cut -d'-' -f2) if [ ! -d "/etc/letsencrypt/live/$domain" ]; then certbot certonly --standalone -d "$domain" --agree-tos --non-interactive --register-unsafely-without-email echo -e "Generating SLL for ${RED}$domain${ENDCOLOR}" else echo -e "${RED}$domain${ENDCOLOR} already has a certificate" fi done