# Clean script in "post execution" in LSF

**URL:** https://discourse.openondemand.org/t/clean-script-in-post-execution-in-lsf/2393
**Category:** Get Help
**Tags:** question
**Created:** [December 7, 2022, 9:32pm UTC](https://discourse.openondemand.org/t/clean-script-in-post-execution-in-lsf/2393 "2022-12-07T21:32:58Z")
**Posts on this page:** 1
**Showing post:** 18

<div class="post-metadata">

### Author: ![fenz](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/fenz/32/496_2.png) [@fenz](https://discourse.openondemand.org/u/fenz)
#### Post date: [December 15, 2022, 10:32am UTC](https://discourse.openondemand.org/t/clean-script-in-post-execution-in-lsf/2393/18 "2022-12-15T10:32:45Z")

</div>

So for completeness (in case needed by anyone else). My final solution is to add the “-Ep” option to LSF in the submit.yml:  
…  
script:  
queue\_name: “interactive”  
native:  
- -Ep “”\<%= staged\_root %\>/post.sh \>\> \<%= staged\_root %\>/output.log 2\>&1""  
…  
So the script I called ‘post.sh’ and attach its output (both out and error) to the output.log.  
The main difference with the “clean.sh” is that this script will not be executed in the same “environment” so the env variables exported in “before.sh”, “script.sh” or others are not available in the “post.sh”. My solution was to “build” the post.sh in the “before.sh” (I ‘echo’ the commands with right values to the post.sh).  
Thanks again all for your help.

---

_[View the full topic](https://discourse.openondemand.org/t/clean-script-in-post-execution-in-lsf/2393)._
