私のBashスクリプトを修正するのに助けが必要です。

私のBashスクリプトを修正するのに助けが必要です。

IKEveサーバーのセキュリティ証明書を更新するためのbashスクリプトを作成しました。スクリプトを実行すると、証明書を更新するには2を押し、Enterを押すように求められます。自動的に2を押して入力し、続行できるコマンドを追加するのに役立つ人はいますか?

以下はbash出力と私のスクリプトです。

What would you like to do?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Keep the existing certificate for now
2: Renew & replace the cert (may be subject to CA rate limits)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1

以下は私のbashスクリプトです。

#!/bin/bash
certbot certonly --rsa-key-size 4096 --standalone --agree-tos --no-eff-email --email [email protected] -d mydomain.com
yes | rm /etc/strongswan/swanctl/x509/fullchain.pem
yes | rm /etc/strongswan/swanctl/private/privkey.pem
yes | rm /etc/strongswan/ipsec.d/cacerts/chain.pem
cp /etc/letsencrypt/live/mydomain.com/fullchain.pem /etc/strongswan/swanctl/x509/fullchain.pem
cp /etc/letsencrypt/live/mydomain.com/privkey.pem /etc/strongswan/swanctl/private/privkey.pem
cp /etc/letsencrypt/live/mydomain.com/chain.pem /etc/strongswan/ipsec.d/cacerts/
exit

ベストアンサー1

使用certbot -n

-n, --non-interactive, --noninteractive
                    Run without ever asking for user input. This may
                    require additional command line flags; the client will
                    try to explain which ones are required if it finds one
                    missing (default: False)

あなた可能またrenew、交換する必要がありますcertonly(不明)。


yes | rmrm -f(削除)を代わりに使用することもできますforce

おすすめ記事