Check if files/folders exists, remove reload-hook

This commit is contained in:
2018-01-09 21:20:52 +01:00
parent c7b7ef36fb
commit 35645a7ec0

View File

@@ -1,7 +1,12 @@
#!/bin/bash #!/bin/bash
rm -rf /usr/local/nginx if [[ -d /usr/local/nginx ]]; then
rm /etc/systemd/system/nginx.service rm -rf /usr/local/nginx
fi
if [[ -f /etc/systemd/system/nginx.service ]]; then
rm /etc/systemd/system/nginx.service
fi
lowercase(){ lowercase(){
echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
@@ -67,7 +72,7 @@ if [ "$ifle" == "Y" ] || [ "$ifle" == "y" ]; then
ln -s /opt/certbot/certbot-auto /usr/local/bin/letsencrypt ln -s /opt/certbot/certbot-auto /usr/local/bin/letsencrypt
cp make_cert /usr/local/bin cp make_cert /usr/local/bin
chmod +x /usr/local/bin/make_cert chmod +x /usr/local/bin/make_cert
crontab -l | { cat; echo "@weekly certbot renew --pre-hook 'systemctl stop nginx' --post-hook 'systemctl start nginx' --renew-hook 'systemctl reload nginx' --quiet"; } | crontab - crontab -l | { cat; echo "@weekly certbot renew --pre-hook 'systemctl stop nginx' --post-hook 'systemctl start nginx' --quiet"; } | crontab -
fi fi
if [ "$DIST" == "Fedora" ]; then if [ "$DIST" == "Fedora" ]; then