I would like to automate the running of this command (which is simple enough):
~/dehydrated/dehydrated --cron --domain www.mydomain.com --out . --challenge http-01
The problem is that I need to email my current host every time the certs renew so that they can implement the changes in the backend (very inefficient, I know, but there is no other way as only they have root access).
When I run the command above, it checks whether the current date is greater/less than 7 days from the certificate expiry date. When the time difference is greater it will return:
Processing www.mydomain.com + Checking domain name(s) of existing cert... unchanged. + Checking expire date of existing cert... + Valid till May 9 19:27:44 2018 GMT (Longer than 7 days). Skipping renew!
Whereas when the time difference is smaller it will renew the certs.
What I would like to do is make the script run every day. When the output is "Skipping renew" I'd like it to do nothing and close, and when the certificates do renew, I'd like to chain in another command (maybe with
&&?) that sends an email to the hosts. I've already set this command up in python with a management command (
python manage.py email_hosts).