# Locks Remove Command

 The `locks:remove` command forcibly releases a lock that is preventing a CLI command or scheduled task from running.

## How It Works

 Long-running commands such as `app:update` and `app:restore` acquire a lock when they start so that only one instance can run at a time. Similarly, each scheduled task acquires a lock while it is running so that overlapping cron executions do not process the same task twice. The lock is stored in the application cache and is released automatically when the command or task finishes.

 If the process is terminated abruptly, for example by a server reboot, a kill signal or the process running out of memory, the lock may be left behind. Until it expires, any further attempts to run the command will exit immediately with a message similar to:

```

The [app:update] command is already running.

```

Likewise, a scheduled task that is still locked will be skipped and the following will be written to the log file:

```

Skipped. Another process is running scheduled task 'Process automatic ticket macros'.

```

 Command locks expire after one hour. Scheduled task locks expire after a period that is calculated from the task's run interval. If you are confident that the command or task is no longer running and you do not wish to wait for the lock to expire, use `locks:remove` to release it.


> Only remove a lock when you are certain that the original process has stopped. Releasing the lock while a command is still running may allow two instances to run at the same time and can result in data loss.

## Usage

 The command is available in two locations, depending on how you ran the initial command. Commands ran using `php artisan` should use the [help desk specific variant](#HelpDesk), and commands ran using `php app-manager/artisan` should use the [app-manager specific variant](#AppManager).

### Help Desk

```

php artisan locks:remove --command=app:upgrade

```

```

php artisan locks:remove --task="App\Modules\Ticket\Models\Macro"

```

#### Usage on Docker

```

docker exec -u supportpal supportpal php artisan locks:remove --command=app:upgrade

```

#### Usage Options

Exactly one of the following options must be provided.

   Option Description     `--command` The name of the command to unlock..   `--task`  The fully qualified class name of the scheduled task to unlock. The value must be wrapped in double quotes. The class name can be found on the **Edit Scheduled Task** screen, see [Scheduled Tasks](Scheduled+Tasks#RunningManually) for further details. If an invalid class name is provided, the command will list all valid class names.   

#### Example Output

```

$ php artisan locks:remove --command=app:upgrade
Lock framework/command-app:upgrade released.

$ php artisan locks:remove --task="App\Modules\Ticket\Models\Macro"
Lock scheduled-task-3.lck released.

```

---

### App Manager

```

php app-manager/artisan locks:remove --command=app:update

```

#### Usage Options

   Option Description     `--command` The name of the command to unlock..  

#### Example Output

```

$ php app-manager/artisan locks:remove --command=app:update
Lock framework/command-app:update released.

```

For further assistance, please refer to the help information which can be found by running:

```
php artisan help locks:remove
```