kereis / traefik-certs-dumper

Dumps Let's Encrypt certificates of a specified domain which Traefik stores in acme.json.
Apache License 2.0
129 stars 24 forks source link

Bugfix for check command exists #70

Closed jaydouble closed 2 years ago

jaydouble commented 2 years ago

in the current version, the check_docker_command is always returning false. So docker restart containers and or services is never going to work.

I've make little fix, and also introduce a new function to check any command exists.

This is also my very first pull request every on github (as far as I remember). So please, don't be angry if I don't do something right.

kereis commented 2 years ago

Hi,

don't worry. :D Thank you for your contribution!

Regarding the bugfix: I haven't tested your changes yet, but doesn't echo print the text and in this case the return value? I have also seen multiple examples, where echo as a sort of return statement, but to be honest, I was a bit afraid testing it because I don't know if it prints the return value into the shell or not. :D

jaydouble commented 2 years ago

The function wil echo it out, but the $() will grab the output, an put that into the variable. example

currentTimestamp=$(date +%s)

if you type date +%s in your terminal, you will see someting like 1641850387. So bash (or any other linux shell) will grab the output of the command, and put it into the variable, so the variable currentTimestamp will now contain 1641850387

kereis commented 2 years ago

I guess it's "the way" to go in Bash. I was sort of thinking Java-ish. :D