To run your own commands at the end of a job an epilog script may be used, which will be executed even if a job time-out occurs. Useful applications could be, e.g., saving data or complicated interaction between jobs.
The './epilog.sh' script is automatically executed, if it exists in your job's home directory. To use another program name, the variable '$USER_EPILOG' is used (at job submission time), e.g. 'export USER_EPILOG=my_epilog_script.sh'. This variable has to be exported to the job with parameters '-v' or '-V' of 'qsub'.
A prolog script may be used in exactly the same way, which will be executed before the job starts. Its name is './prolog.sh' or defined by '$USER_PROLOG'.