Skip to content

Instantly share code, notes, and snippets.

@giulianoriccio
Last active May 29, 2017 08:51
Show Gist options
  • Save giulianoriccio/352e4b69a4fe042b7cdf4cbc4c6430e5 to your computer and use it in GitHub Desktop.
Save giulianoriccio/352e4b69a4fe042b7cdf4cbc4c6430e5 to your computer and use it in GitHub Desktop.
let's encrypt on plesk using certbot - certificate renewal hook
#!/bin/bash
timestamp=$(date +"%Y-%m-%d %H:%M:%S")
/usr/local/psa/bin/certificate -c "${RENEWED_DOMAINS%% *} $timestamp" -domain ${RENEWED_DOMAINS%% *} -key-file $RENEWED_LINEAGE/privkey.pem -cert-file $RENEWED_L$
if [[ $? != 0 ]] ; then
echo "The certificate creation for ${RENEWED_DOMAINS%% *} has failed on Plesk"
exit 1
fi
/usr/local/psa/bin/subscription -u ${RENEWED_DOMAINS%% *} -certificate-name "${RENEWED_DOMAINS%% *} $timestamp"
if [[ $? != 0 ]] ; then
echo "The certificate could not be assigned to ${RENEWED_DOMAINS%% *} on Plesk"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment