# How to create a custom epilogue script for certain jobs only?

**URL:** <https://community.openpbs.org/t/how-to-create-a-custom-epilogue-script-for-certain-jobs-only/3168>\
**Category:** Users/Site Administrators\
**Created:** [June 28, 2022, 4:42pm UTC](https://community.openpbs.org/t/how-to-create-a-custom-epilogue-script-for-certain-jobs-only/3168 "2022-06-28T16:42:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![feacluster](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@feacluster](https://community.openpbs.org/u/feacluster)\
**Post date:** [June 28, 2022, 4:42pm UTC](https://community.openpbs.org/t/how-to-create-a-custom-epilogue-script-for-certain-jobs-only/3168/1 "2022-06-28T16:42:36Z")

</div>

I understand that epilogue will run some commands after any job finishes. What I want is an epilogue for only certain jobs and that epilogue is different for each of the jobs.

Specifically I want certain commands to be run after a job is killed due to wall time.

---

<div class="post-metadata">

**Author:** ![adarsh](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@adarsh](https://community.openpbs.org/u/adarsh)\
**Post date:** [June 28, 2022, 5:18pm UTC](https://community.openpbs.org/t/how-to-create-a-custom-epilogue-script-for-certain-jobs-only/3168/2 "2022-06-28T17:18:20Z")

</div>

The generic $PBS\_HOME/mom\_priv/epilogue is replaced using execjob\_epilogue hook.  
Also you have execjob\_end hook. Based on what attribute values are available for these these hook events , you can implement your own logic to identify the job and decide to execute or not.

---

<div class="post-metadata">

**Author:** ![feacluster](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@feacluster](https://community.openpbs.org/u/feacluster)\
**Post date:** [June 28, 2022, 7:48pm UTC](https://community.openpbs.org/t/how-to-create-a-custom-epilogue-script-for-certain-jobs-only/3168/3 "2022-06-28T19:48:42Z")

</div>

> [@adarsh](#):
>
> execjob\_epilogue

Thanks. I think the hooks option may be too complicated for me . I only need the custom epilogue for jobs that get assigned to one particular node. So on that node I made this epilogue script which seems to work ok:

```auto
[127]root@lustwz17:.../spool/pbs/mom_priv# pwd
/var/spool/pbs/mom_priv
[0]root@lustwz17:.../spool/pbs/mom_priv# cat epilogue
#!/bin/bash
echo "From the epilogue script" > /tmp/$1_epilogue.txt
echo $@ >> /tmp/$1_epilogue.txt

sudo -u catmap bash -c 'source ~/.bashrc;stop fluentIN;'

[0]root@lustwz17:.../spool/pbs/mom_priv#

```
