Sign in to follow this  
Followers 0
Mohsin

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

1 post in this topic

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0