change_script Block
Placement | job -> group -> task -> template -> change_script |
The change_script
block allows operators to configure scripts that
will be executed on template change. This block is only used when template
change_mode
is set to script
.
change_script
Parameters
command
(string: "")
- Specifies the full path to a script or executable that is to be executed on template change. The command must return exit code 0 to be considered successful. Path is relative to the driver, e.g., if running with a container driver the path must be existing in the container. This option is required ifchange_mode
isscript
.args
(array<string>: [])
- List of arguments that are passed to the script that is to be executed on template change.timeout
(string: "5s")
- Timeout for script execution specified using a label suffix like"30s"
or"1h"
.fail_on_error
(bool: false)
- Iftrue
, Nomad will kill the task if the script execution fails. Iffalse
, script failure will be logged but the task will continue uninterrupted.
Template as a script example
Below is an example of how a script can be embedded in a data
block of another
template
block: