Skip to content

Instantly share code, notes, and snippets.

@sjourdan
Created March 24, 2017 16:15
Show Gist options
  • Save sjourdan/3f0e52dd99df346aa9221b53bdd30720 to your computer and use it in GitHub Desktop.
Save sjourdan/3f0e52dd99df346aa9221b53bdd30720 to your computer and use it in GitHub Desktop.
le-auto.sh crontab
#!/usr/bin/env bash
# 2015/12/19 initial version
# 2016/05/22 bugfix non-www domains
LE_BIN="/home/sjourdan/letsencrypt/letsencrypt-auto"
EMAIL="[email protected]"
DOMAINS="domain1.com domain2.com"
function generate_common_certs(){
for domain in ${DOMAINS}; do
${LE_BIN} --text --email ${EMAIL} --domains ${domain},www.${domain} --agree-tos --renew-by-default --webroot --webroot-path /srv/www/${domain}/htdocs/ certonly
done
}
function reload_https_server(){
sudo service nginx reload >/dev/null 2>&1
}
generate_common_certs
reload_https_server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment