S
S
Sharov Dmitry2016-08-25 14:20:24
bash
Sharov Dmitry, 2016-08-25 14:20:24

How to automatically pass data to bash script?

started to deal with ssl certificates letsencrypt.org
set up everything set up but then the plug came out with automatic re-release
, you can run the bash script in the cron

#!/bin/sh
CONFIG_NAME=$1 
MODE_RUN=$2

cd /opt/letsencrypt/ 
./certbot-auto --config /etc/letsencrypt/configs/$CONFIG_NAME.conf $MODE_RUN

if [ $? -ne 0 ]
  then
        ERRORLOG=`tail /var/log/letsencrypt/letsencrypt.log`
        echo -e "The Let's Encrypt cert has not been renewed! \n \n" \
        $ERRORLOG
  else
    nginx -s reload 
fi
exit 0

but at run time the action is requested to reissue or create a new certificate

What would you like to do?
-------------------------------------------------- -----------------------------
1: Keep the existing certificate for now
2: Renew & replace the cert (limit ~5 per 7 days)
------------------------------------------------ -------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):

how to tell the ./certbot-auto script to execute the second script and press enter

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Novikov, 2016-08-25
@vlom88

--force-renewal, --renew-by-default
If a certificate already exists for the requested
domains, renew it now, regardless of whether it is
near expiry. (Often --keep-until-expiring is more
appropriate). Also implies --expand. (default: False)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question