Appendices > Appendix G: Prologue and epilogue scripts > Script environment

G.2 Script environment

The prologue and epilogue scripts can be very simple. On most systems, the script must declare the execution shell using the #!<SHELL> syntax (for example, "#!/bin/sh"). In addition, the script may want to process context sensitive arguments passed by TORQUE to the script.

Prolog Environment

The following arguments are passed to the prologue, prologue.user, and prologue.parallel scripts:

Argument Description
argv[1] job id
argv[2] job execution user name
argv[3] job execution group name
argv[4] job name (TORQUE 1.2.0p4 and higher only)
argv[5] list of requested resource limits (TORQUE 1.2.0p4 and higher only)
argv[6] job execution queue (TORQUE 1.2.0p4 and higher only)
argv[7] job account (TORQUE 1.2.0p4 and higher only)

Epilog Environment

TORQUE supplies the following arguments to the epilogue, epilogue.user, epilogue.precancel, and epilogue.parallel scripts:

Argument Description
argv[1] job id
argv[2] job execution user name
argv[3] job execution group name
argv[4] job name
argv[5] session id
argv[6] list of requested resource limits
argv[7] list of resources used by job
argv[8] job execution queue
argv[9] job account
argv[10] job exit code

The epilogue.precancel script is run after a job cancel request is received by the MOM and before any signals are sent to job processes. If this script exists, it is run whether the canceled job was active or idle.

The cancel job command (qdel) will take as long to return as the epilogue.precancel script takes to run. For example, if the script runs for 5 minutes, it takes 5 minutes for qdel to return.

For all scripts, the environment passed to the script is empty. Also, standard input for both scripts is connected to a system dependent file. Currently, for all systems this is /dev/null. Except for epilogue scripts of an interactive job, prologue.parallel, epilogue.precancel, and epilogue.parallel, the standard output and error are connected to output and error files associated with the job. For an interactive job, since the pseudo terminal connection is released after the job completes, the standard input and error point to /dev/null. For prologue.parallel and epilogue.parallel, the user will need to redirect stdout and stderr manually.

Related topics