| 1234567891011121314151617181920212223242526 |
- #!/bin/sh
- # SSL Certificate Renewal Script
- # This script renews SSL certificates and reloads nginx
- set -e
- echo "Checking for SSL certificate renewal..."
- # Renew certificates
- certbot renew --quiet
- # Check if renewal was successful and certificates were updated
- if [ $? -eq 0 ]; then
- echo "SSL certificates renewed successfully"
-
- # Reload nginx to use new certificates
- # Send SIGHUP to nginx process (graceful reload)
- echo "Reloading nginx..."
- nginx -s reload || {
- echo "Warning: Could not reload nginx. You may need to restart the nginx container manually."
- }
- else
- echo "No renewal needed or renewal failed"
- fi
|