forked from axiom-team/astroport
27 lines
738 B
Bash
Executable File
27 lines
738 B
Bash
Executable File
#!/bin/bash
|
|
|
|
log="/var/log/ssl_renew.log"
|
|
date=$(date +%d-%m-%Y)
|
|
|
|
renew=$(certbot renew --pre-hook "service nginx stop" --post-hook "service nginx start")
|
|
|
|
echo "####################################################################################" >> $log
|
|
echo "#################################### $date ####################################" >> $log
|
|
echo "####################################################################################" >> $log
|
|
|
|
echo "$renew" >> $log
|
|
|
|
if [[ $renew = *"No hooks were run"* ]]; then
|
|
echo "Rien n'a été fait" >> $log
|
|
else
|
|
sleep 5
|
|
/etc/init.d/nginx stop
|
|
sleep 1
|
|
killall nginx
|
|
sleep 3
|
|
/etc/init.d/nginx restart &>> $log
|
|
echo "Des certificats ont été renouvellés" >> $log
|
|
fi
|
|
|
|
exit 0
|