-
Create the script
- Create a file named renew-ssl-jenkins.sh anywhere accessible and enter the code below:
#!/bin/bash # change password value to your password SSLPASS=MyPassword123 sudo service apache2 stop || true certbot renew || true cd /etc/letsencrypt/live/mysite.com rm /var/lib/jenkins/jenkins.jks openssl pkcs12 -inkey privkey.pem -in fullchain.pem -export -out keys.pkcs12 -password pass:$SSLPASS || true keytool -importkeystore -srcstorepass $SSLPASS -deststorepass $SSLPASS -noprompt -v -srckeystore keys.pkcs12 -srcstoretype pkcs12 -destkeystore /var/lib/jenkins/jenkins.jks || true sudo service jenkins restart || true sudo service apache2 start || true
- Create a file named renew-ssl-jenkins.sh anywhere accessible and enter the code below:
-
Execute the script every month using cron
- Crontab entry:
... 0 1 1 * * ~/renew-ssl-jenkins.sh > /var/log/renew-ssl-jenkins.log ...
- Crontab entry:
Add new comment