Search code examples
sshplesk

Supress ssh mail errors only


Hello I currently have a script that creates ssh tasks on the fly but want to be able to suppress only ones that have to do with email creation, for example if I try

/usr/local/psa/bin/mail -r test@domain.com

if the user does not exist I get

An error occured during mailname removal: Mailname 'test@domain.com' doesn't exists

or for that matter if I create an account, suppress the output.


Solution

  • You can append 2>/dev/null to the end the line which is responsible for mailbox creation and removal, e.g.: Before:

    /usr/local/psa/bin/mail -r $var
    

    After:

    /usr/local/psa/bin/mail -r $var 2>/dev/null