From 7acc436e612fa55e0272d1e3ccf0e6ffc8e7abd2 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Mon, 19 Jun 2023 11:28:00 -0700 Subject: [PATCH] fix if statements that check for files --- bin/vmail-dkim-del.sh | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/bin/vmail-dkim-del.sh b/bin/vmail-dkim-del.sh index 0deda32..9bae134 100755 --- a/bin/vmail-dkim-del.sh +++ b/bin/vmail-dkim-del.sh @@ -39,31 +39,31 @@ fi if [ ! -f /etc/ssl/dkim/$domain.dkim ]; then echo "DKIM for $domain does not exist." exit 1 -fi - -if [[ -f /etc/ssl/dkim/$domain.selector ]]; then - echo Deleting the `cat /etc/ssl/dkim/$domain.selector`._domainkey.$domain DKIM key. - if [[ -f /usr/local/etc/pdns.conf ]] && - echo To remove the associated DNS record run this command: - echo - echo pdns-rr-del.sh -z $domain -n `cat /etc/ssl/dkim/$domain.selector`._domainkey.$domain -t TXT - else - echo You can now delete the DNS TXT record for `cat /etc/ssl/dkim/$domain.selector`._domainkey.$domain - fi else - echo You can now delete the associated DNS TXT record. + if [[ -f /etc/ssl/dkim/$domain.selector ]]; then + echo Deleting the `cat /etc/ssl/dkim/$domain.selector`._domainkey.$domain DKIM key. + if [[ -f /usr/local/etc/pdns.conf ]]; then + echo To remove the associated DNS record run this command: + echo + echo pdns-rr-del.sh -z $domain -n `cat /etc/ssl/dkim/$domain.selector`._domainkey.$domain -t TXT + else + echo You can now delete the DNS TXT record for `cat /etc/ssl/dkim/$domain.selector`._domainkey.$domain + fi + else + echo You can now delete the associated DNS TXT record. + fi + rm /etc/ssl/dkim/$domain.dkim fi -rm /etc/ssl/dkim/$domain.dkim -if [ ! -f /etc/ssl/dkim/$domain.dns ]; then +if [ -f /etc/ssl/dkim/$domain.dns ]; then rm /etc/ssl/dkim/$domain.dns fi -if [ ! -f /etc/ssl/dkim/$domain.pem ]; then +if [ -f /etc/ssl/dkim/$domain.pem ]; then rm /etc/ssl/dkim/$domain.pem fi -if [ ! -f /etc/ssl/dkim/$domain.pub ]; then +if [ -f /etc/ssl/dkim/$domain.pub ]; then rm /etc/ssl/dkim/$domain.pub fi -if [ ! -f /etc/ssl/dkim/$domain.selector ]; then +if [ -f /etc/ssl/dkim/$domain.selector ]; then rm /etc/ssl/dkim/$domain.selector fi