Last active
August 8, 2019 11:06
-
-
Save AstraSerg/1c571bc1c0ea49d5fb8934c034cb1b2a to your computer and use it in GitHub Desktop.
post renew SSL certs lego
This file contains hidden or 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
#!/bin/bash | |
# checks if certs was updated by lego | |
# and put it to spot | |
key_file='/home/certs/certificates/hs1.srv.key' | |
crt_file='/home/certs/certificates/hs1.srv.crt' | |
mix_file='/opt//config/server.pem' | |
# take 1 line from the middle of new (?) cert | |
l="$(head -n 3 $crt_file | tail -n 1)" | |
grep "$l" $mix_file > /dev/null \ | |
|| { cat $key_file $crt_file > $mix_file; systemctl restart spot; } | |
# and cron: | |
#cat /etc/cron.d/renewcerts | |
#0 4 * * * root docker run --rm -v /home/spotcerts:/home/spotcerts --net=host goacme/lego --domains=hs1.srv.ru -a -m [email protected] --tls --path /home/spotcerts renew; /home/scripts/update_certs.sh | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment