krtab / agnos

Obtain (wildcard) certificates from let's encrypt using dns-01 without the need for API access to your DNS provider.
MIT License
304 stars 8 forks source link

Remove text coloring for cron jobs #25

Closed Jay2k1 closed 1 year ago

Jay2k1 commented 1 year ago

I have set up a cron job to run agnos twice a day (just like certbot's cron), but the e-mails are looking a bit weird:

2023-02-17T02:46:36.236696Z  INFO agnos: Certificate chain found on disk, checking its validity
2023-02-17T02:46:36.238873Z  INFO agnos: No certificate in the chain requires renewal.
2023-02-17T02:46:36.238896Z  INFO agnos: Certificate chain found on disk, checking its validity
2023-02-17T02:46:36.240869Z  INFO agnos: No certificate in the chain requires renewal.

Proposal: agnos should only color its output when it is being run on a terminal. In bash, you could use test -t 1 to check for a terminal, for example (1 being file descriptor 1; 0 = stdin, 1 = stdout, 2 = stderr).