开发者

Linux/OpenSSL:Send find output to openssl

开发者 https://www.devze.com 2022-12-28 23:40 出处:网络
I am trying to send the output from the find command to OpenSSL in order to find out when certificates expire.

I am trying to send the output from the find command to OpenSSL in order to find out when certificates expire.

This finds the files

find . -name \*.pem -type f

This generates the cert info I want

openssl x509 -in certname.pem -noout -enddate

Can I merge these two?

Thanks for your开发者_JAVA百科 help.


find . -name \*.pem -type f -execdir openssl x509 -in {} -noout -enddate \;


Just as a general comment on find: your command will run much faster if you take the output of find and pipe it to xargs and let that run the command. The problem being that find spawns a new command for each matching file and that is very slow but if you can pass multiple parameters to the same command (like xargs does) you save all those forks and context switches. It works really well with commands like grep.

0

精彩评论

暂无评论...
验证码 换一张
取 消