How can it set the different file name of .out and .err automatically when I qsub job every time?
Please submit with a job name
#PBS -N
or
qsub -N
[pbsdata@pbsserver ~]$ qsub -N testjob – /bin/sleep 1
2.pbsserver
[pbsdata@pbsserver ~]$ qsub -N myjob – /bin/sleep 1
3.pbsserver
[pbsdata@pbsserver ~]$ ls -ltr
.o
.e
-rw------- 1 pbsdata pbsdata 0 Aug 22 08:17 testjob.o2
-rw------- 1 pbsdata pbsdata 0 Aug 22 08:17 testjob.e2
-rw------- 1 pbsdata pbsdata 0 Aug 22 08:17 myjob.o3
-rw------- 1 pbsdata pbsdata 0 Aug 22 08:17 myjob.e3
Can I make it associated with the job id? For example, if the job id is 6950.host, my output and error files will be automatically generated as 6950.host.out and 6950.host.err.
It is automatically associated with the job id, if you see the example shared above
<jobname>.o<jobid>
<jobname>.e<jobid>
Is it possible to use the job id as the job name, such as the format of 6950.host.out?
Job name / JobID are created once the job is accepted.
We cannot variable substitute JobNames and JobID within the PBS attributes.
cat pbs.sh ; chmod +x pbs.sh ; qsub pbs.sh
#!/bin/bash
#PBS -N test
#PBS -l select=1:ncpus=1:mem=1gb
/bin/hostname >> $PBS_JOBNAME.$PBS_JOBID.out 2>&1