Linux/OpenSSL:Send find output to openssl
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.
精彩评论