Ubuntu: Suppress output for a2ensite and a2dissite commands



Question:

I've been trying to find a way to suppress the output for the a2ensite and a2dissite commands. Man pages don't seem to provide for any sort of "silent" or "quiet" mode.

Here's what I see with a2ensite:

Enabling site...  Enabling site HELLO.  To activate the new configuration, you need to run:    service apache2 reload  

And with a2dissite:

removing dangling symlink /etc/apache2/sites-enabled/mysite  

Is there any way to prevent any output at all ?


Solution:1

So, I tried > dev/null before but it didn't work as expected. Instead, the trick was to use:

a2ensite/a2dissite mysite  > /dev/null 2>&1  

Goal is simply to format the output as I wish, with echo -e "\tWhatever message" and keep the output clean and consistent.


Solution:2

I'm not sure why you don't want to see any output from these commands. But you can simply redirect the output to /dev/null with

a2ensite ... > /dev/null  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »