Jump to content
  • Announcements

    • admin

      PBS Forum Has Closed   06/12/17

      The PBS Works Support Forum is no longer active.  For PBS community-oriented questions and support, please join the discussion at http://community.pbspro.org.  Any new security advisories related to commercially-licensed products will be posted in the PBS User Area (https://secure.altair.com/UserArea/). 
Sign in to follow this  
Mohsin

Help: how to use HOOK to modify the contents of the submitted script.

Recommended Posts

Hi PBSPro Community,

I am submitting the following test.sh script using

qsub test.sh

command. I want to use HOOK so that it modifies the contents of test.sh script prior to its submission. Specifically, I want to add module list &> module_loaded.$PBS_JOBID command at the end of the test.sh file using HOOK.

test.sh

#!/bin/bash
#PBS -l ncpus=2
#PBS -l walltime=00:02:00
#PBS -l mem=2GB

cd $PBS_O_WORKDIR

module load use.own
module load somemodule

mpicc -o mpi_test mpi_test.c
mpirun -np 2 mpi_test

More clearly, I will submit the above test.sh file, but eventually the following modified-test.sh will be submitted and executed. Note that creating a new file from test.sh to modified-test.sh is not necessary. I am mentioning this filename for the clarification of the requirement.

modified-test.sh

#!/bin/bash
#PBS -l ncpus=2
#PBS -l walltime=00:02:00
#PBS -l mem=2GB

cd $PBS_O_WORKDIR

module load use.own
module load somemodule

mpicc -o mpi_test mpi_test.c
mpirun -np 2 mpi_test

module list &> module_loaded.$PBS_JOBID # Added command

As I am a newbie of HOOK, any detailed comment (preferably complete code)  will be highly appreciated.

Thank you very much for your time!

Cheers,

Mohsin

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×