Here is an example of pbs that I use:
#!/bin/bash
#PBS -S /bin/bash
#PBS -N myJob
#PBS -l nodes=1:ppn=4
#PBS -l walltime=50:00:00
#PBS -q route
export [email protected]
#PBS -m ae
#PBS -M [email protected]
./script1.sh
echo $PBS_JOBID $PBS_O_WORKDIR | mail -s "$PBS_JOBNAME script1 done" $MYMAIL
./script2.sh
echo $PBS_JOBID $PBS_O_WORKDIR | mail -s "$PBS_JOBNAME script2 done" $MYMAIL
./script3.sh
echo $PBS_JOBID $PBS_O_WORKDIR | mail -s "$PBS_JOBNAME script3 done" $MYMAIL
./script4.sh
As you can see I want to receive notifications during the process. My problem is that users must write twice their email address.
I tried:
#PBS -M $MYMAIL
but it does not work.
I also tried to find a pbs variable containing the email stored during
#PBS -M [email protected]
but nothing ...
An idea ?
You are sending different emails by different methods. With the #PBS -M line you are telling pbs_server on the head node where is should send emails about the job and with "|mail " you are sending mail to the user from the node running the job.
It seems that Torque does not set an environment variable that contains the contents of -M so we can't pass that to mail.
I have two ideas for you. The first is trying to capture the Mail_Users line from qstat and parsing it.
qstat -f [job number] | grep Mail_Users
The second is to create a .forward file for each user since Torque will email the local user account by default eliminating the #PBS -M line. You will still need to pass an email or account name to mail but you may be able to get away with:
mail -s "$PBS_JOBNAME script1 done" `whoami`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With