how to run openssl dhparam quietly?

Posted on

Problem :

I’m writing an install script including generating a Diffie Hellman file with the command

openssl dhparam -out /tmp/dhparam.pem 2048

As it can take some time and it isn’t required for the following steps, I was thinking to make it run in the background but I can’t find a way to make it run quietly, it keeps logging in the terminal where the script is running. Here are some failed attempts:

openssl dhparam -out /tmp/dhparam.pem 2048 > /dev/null &
openssl dhparam -out /tmp/dhparam.pem -quiet 2048 &

It doesn’t seem to be writing to stdout, (but rather directly on /dev/tty ?) so I’m out of idea on how to make it quiet: any clue?

Solution :

Are you certain the command is not writing output to stderr? Does the following command run silently as you’re expecting?

openssl dhparam -out /tmp/dhparam.pem 2048 &>/dev/null

Leave a Reply

Your email address will not be published. Required fields are marked *