Skip to content

Latest commit

 

History

History
50 lines (33 loc) · 1.58 KB

README.md

File metadata and controls

50 lines (33 loc) · 1.58 KB

nginx-certwatch

Independent certwatch cron script for all nginx ssl vhosts.


See also: letsencrypt-watch


This was mainly built as I am using nginx and the normal /etc/cron.daily/certwatch script is not picking up the SSL certificates in my vhosts as it relies on apache and quits if it is not found:

test -x /etc/httpd/modules/libmodnss.so || return 0
# and
test -r /etc/httpd/conf/httpd.conf    || return 0

Add this shell script to your crontab (or copy it to /etc/cron.daily/) to be notified via email when your certificates reach expiry. The default behavior (without arguments) is to notify the root user, once the certificates will expire in 30 days or less.

Usage

All command line arguments are optional and if not specified, the default values are used.

$ nginx-certwatch [--period=30] [--email=[email protected]] [--path=/etc/nginx]

 --period=XX       specify period in days to check for (Default: 30)
 --email=root      specify email to send notifications if period expires (Default: root)
 --path=/etc/path  specify nginx config base path (Default: /etc/nginx) 

Cronjob

Put the following example in your cron daily and replace the email with your own.

@daily /path/to/nginx-certwatch [email protected]

or

0 0 * * * /path/to/nginx-certwatch [email protected]

Note