# Rollback on Failure

The purpose of a rollback is to ensure that your software will always be able to return to a stable and running state. Rollback on Failure is a rollback of all the steps that have been wholly or partially completed, i.e., a general rollback of the flow. This includes deleting any files that have been delivered, returning the directory structure to its previous state, and undoing any commands and scripts that have run so far. After Rollback on Failure, your previously running versions will be running again.&#x20;

If you choose Run Rollback in any of your steps, you need to enable and configure the Rollback on Failure action. This includes entering the command or script that will perform the rollback.

When you turn on Rollback on Failure here, Run Rollback in each step will be turned on.

To enable Rollback on Failure, do the following:

1. In the Create New Flow page, mark **Rollback on Failure**.&#x20;

<div align="left"><figure><img src="https://content.gitbook.com/content/OX8HIrQ8f257lv49Od1Z/blobs/3jJ22u1LDQuzqAtAm3XF/rollback-on-failure-nui-01.png" alt="" width="375"><figcaption></figcaption></figure></div>

2. Choose to run either a command or a script that will perform the rollback.&#x20;
   * **Command**: Include the command and the values for all required parameters.&#x20;
   * **Script**: Prepare the script in advance and upload the file here.

## What's Next?

Learn more about on failure and rollback configurations in [On Failure Policy for Step](https://docs.connect.jfrog.io/features-new-ui/deployments/update-flow/on-failure-and-rollback/on-failure-policy-for-step).
