How to set our own mail script in PBS

Hi i need to set my simple mail script in PBS so how to set or disable mail in PBS

create a little mail script which you configure into PBS

The script is very simple:

------- PBSmail.sh ------

#!/bin/bash

exit 0


how to stop mail in PBS server
or
how to write hook to execute own mail script instead of system sendmail ?

Disable or remove smtp/postfix/sendmail deployment from the PBS Server node or stop & disable their services.

Please test a script that can send a mail with your required data without PBS Pro , if this is working.
Then you can invoke that mail script in runjob hook, prologue , epilogue hooks

Thanks Adarsh,

if we write a hook for using our mail script then PBS mail will stop or it will also execute by default , actually we wanted to replace PBS mail with our own PBSmail script , please suggest any option for it and could you also send me a hook code to do it

thanks

The below directive should avoid sending any mails
#PBS -m n

To be on the safer and cleaner side, you can create a rule or filter to block all mails sent from adm@pbsserver.co.com which depends on your mail_from attribute and pbsserver fqdn

root@pbsserver~# qstat -Bf | grep mail
mail_from = adm

#create a bash script that can get all the details that needs to mailed to the recipient , accessible by the respective hook / hook event

in runjob hook or mom hook event you can call os.system(“source bash_script parameters”)

it is working

Thanks Adarsh

1 Like

Thank you @depaksoni.
Please share it to the community, many are looking into this

Hi,
i have just set -m n in default_qsub_arguments so mails has stopped but not started hook yet , will share once complete :slight_smile:

1 Like

Thank you @depaksoni