PBSPro job cleanup

how to do pbspro job cleanup by using epilogue or hook, we are using ansys application


Please create a file called “epilogue” in $PBS_HOME/mom_priv/ on all the compute nodes.
Please give the executable permission chmod +x $PBS_HOME/mom_priv/epilogue

Place the below contents in the file :

echo "From the epilogue script" > /tmp/$1_epilogue.txt
echo $@  >> /tmp/$1_epilogue.txt

Run a sample job and you would see the /tmp/XXX_epilogue.txt being populated.
You can implement the logic to cleanup the processes or directories .
If you implement the same in execjob_epilogue hook event, that takes the precedence over epilogue script and only hook will be executed.