Linux - Using Cron to schedule periodic jobs like certificate updates
Daniel Nashed – 10 April 2024 09:38:27
In all the years I have never looked into cron.
But it is really a very straightforward functionality, which is used by Linux itself.
You can either schedule user specific jobs or use /etc/cron.d files or /etc/crontab.
There is a certificate update script --> https://github.com/HCL-TECH-SOFTWARE/domino-cert-manager/blob/main/examples/nginx/cert_upd_nginx.sh
I did not automate it end to end yet.
A quick look into /etc/crontab shows how it works.
I also added Certificate URL Health on certstore.nsf on top.
But this should automatically pull updated certs from certstore.nsf daily and update the NGINX config.
-- Daniel
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
07 07 * * * nginx /local/nginx/cert-update-dnug-lab.sh >> /local/nginx/cert-update.log 2>&1
- Comments [1]