Plex Meta Manager is designed to be a background running service that "wakes up" and "sleeps" when it is scheduled to do so. By default and unless configured using the [Time to Run Command](../environmental.md#time-to-run), Plex Meta Manager expects to run every day at 3AM local time.
Whilst it is possible to have `python plex-meta-manager.py` running in an open window constantly, this is not the recommended approach as it relies on an always-open command window that can be obtrusive to the user.
Instead, it is recommended to set an automated scheduling service so that Plex Meta Manager can run in the background when scheduled to without any visible impact to the user (other than the Plex libraries and playlists updating).
Using docker is the simplest and most robust solution to automating Plex Meta Manager scheduling.
When running Plex Meta Manager within docker, the session will resume after a system reboot (assuming Docker is set to start at system startup, which is the default) and Plex Meta Manager will run in the background at all times.
There's a [Docker Walkthrough](docker) with more detailed instructions on setting up Plex Meta Manager within docker. The simplest command to facilitate a docker run is:
```
docker run -d \
--restart=unless-stopped \
-v /path/to/config:/config:rw \
meisnate12/plex-meta-manager
```
This will run Plex Meta Manager in the background persistently until it is stopped by the user. While the docker container will be persistently running, Plex Meta Manager will not begin the run until the scheduled time.
Further customizations of the docker run command can be used to specify set times to run Plex Meta Manager, further information on this and other Run Commands can be found [here](../environmental.md#time-to-run)
</details>
## Windows
<details>
<summary>Click to Expand</summary>
<br/>
### Task Scheduler
Windows Task Scheduler is advised for those who followed the Windows instructions in the [Local Walkthrough Guides](local) and/or do not want to run Plex Meta Manager within docker.
Windows Task Scheduler allows the user to run commands and services at scheduled times and intervals.
There are two methods of running Plex Meta Manager:
* Single run Scheduled Task
* Background run Scheduled Task
These will be explained further down this page.
These guides assume the user has followed the Windows instructions in the [Local Walkthrough Guides](local) which includes setting up the [virtual environment](local.md#setting-up-a-virtual-environment). Please also ensure to edit any commands to be reflective of the live environment (such as usernames, installation directories).
### Background Run Scheduled Task
This method will start Plex Meta Manager at system startup and will keep the script running in the background indefinitely. The user can then define set days and times for the Configuration File to be processed, and Plex Meta Manager will handle processing as and when required.
This is the recommended approach as it allows the user additional control over how and when Plex Meta Manager processes.
<details>
<summary>Background Run Scheduled Task</summary>
<br/>
1. Create a `waiter.cmd` file by opening the text editor (i.e. Notepad, TextEdit) and pasting the following code:
```batch
cd C:\User\USERNAMEHERE\Plex-Meta-Manager
.\pmm-venv\Scripts\python .\plex_meta_manager.py
```
* This will navigate to the PMM directory, then run PMM. At the scheduled time [as defined within Plex Meta Manager], PMM will process the Configuration File and will then wait until the next scheduled time.
1. Open Task Scheduler by searching for it in the Start Menu or by opening the Run window (Windows + R) and typing taskschd.msc before hitting OK.
* ** Ensure that Task Scheduler is opened and not Task Manager **
8. Copy the directory everything up to but not including `runner.cmd` from the "Program/Script" field, and paste it into the "Start in" field. This is `C:\User\IEUser\Plex-Meta-Manager-1.15.1` in the example below, then select "next".
Plex Meta Manager will now launch at system startup, but will wait until the user-specified scheduled time before executing, and will then wait in the background for the next scheduled run.
</details>
### Single Run Scheduled Task
This method will start Plex Meta Manager at the desired time, immediately begin running the Configuration File and will then kill the process once it has completed.
<details>
<summary>Single Run Scheduled Task</summary>
<br/>
1. Create a `runner.cmd` file by opening the text editor (i.e. Notepad, TextEdit) and pasting the following code:
* This will navigate to the PMM directory, then launch PMM using the `-r`/`--run` flag which triggers an immediate run. Once complete, Plex Meta Manager will exit.
Save this file to C:\Users\USERNAMEHERE\Plex-Meta-Manager\runner.cmd`.
2. Open Task Scheduler by searching for it in the Start Menu or by opening the Run window (Windows + R) and typing taskschd.msc before hitting OK.
* ** Ensure that Task Scheduler is opened and not Task Manager **
9. Copy the directory everything up to but not including `runner.cmd` from the "Program/Script" field, and paste it into the "Start in" field. This is `C:\User\IEUser\Plex-Meta-Manager-1.15.1` in the example below, then select "next".