Last active
January 12, 2017 20:45
-
-
Save hansdg1/31a7a605f10e67c4e8b0b597657443ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Hans Guthrie | |
# Date: 7/18/2016, updated 10/3/2016 | |
# Purpose: Update letsencrypt certificate. This script is typically run from a crontab job to make this process automatic | |
# Future: Improve logging functionality and make it cleaner | |
# Notes: See this website for how I got the date and time logging: https://www.evernote.com/shard/s57/nl/6650561/877447ff-6220-42d9-8e53-ddb7580cd562?title=log%20bash%20script%20output%20to%20file%20with%20timestamp | |
# Gist: https://gist.github.com/hansdg1/31a7a605f10e67c4e8b0b597657443ac | |
LOGFILE=/var/log/letsencrypt/certbox-renew.log | |
echo "\n###############################################################################" >> $LOGFILE 2>&1 | |
echo "$(date) : Starting work" >> $LOGFILE 2>&1 | |
service nginx stop | |
printf 'Stopping nginx service\n##### (33%%)\r' | |
sleep 1 | |
printf 'Renewing certificate\r############# (66%%)\r' | |
echo "$(/opt/letsencrypt/certbot-auto --nginx renew)" >> $LOGFILE 2>&1 | |
sleep 1 | |
service nginx start | |
printf '####################### (100%%)\r' | |
printf '\n' | |
echo "\n$(date) : Finished work" >> $LOGFILE 2>&1 | |
echo "###############################################################################\n" >> $LOGFILE 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment