# Running a job from an event

With the action **Run Plugin**, an [event](Users-Events.md) hands the files it is about to a plugin or to a job. This is how files are processed the moment they arrive: decrypted, checked, copied to another system, announced.

The part **Plugin / CrushTask Details** of [the event editor](Users-Events-Editor.md) appears when **Run Plugin** is chosen.

## Plugin / CrushTask

The list offers every plugin of the server, each twice:

| Entry | Means |
|---|---|
| a plugin's name, such as **HomeDirectory** | the plugin as it is set up in [Plugins](Prefs-Plugins.md) |
| the name with **(User Defined)** | the same plugin with settings of its own for this event |
| **CrushTask (User Defined)** | a job that is designed here and belongs to this event |
| a job's name, in the group **Job** at the end of the list | that job of the [Jobs](Jobs.md) app, as it is there |

"Warning: Not all plugins can be called from an event." Most plugins act at login and have nothing to do with a file. The entries that are used nearly always are **CrushTask (User Defined)** and the jobs.

## The job of the event

| Setting | What it does | New event |
|---|---|---|
| **Enabled** | the job runs. Off: the event does nothing. | off |
| **Debug** | more is written to the log about each step | off |
| **Save state between steps** | the job keeps what it knows after each step, so that it can go on after an interruption | on |
| **Logging enabled** | the job writes its own log | on |
| **Save results of job at end** | the run is kept and can be looked at later in the Jobs app | on |
| **Open designer** | opens the job in the designer: the canvas with **Start** and **End** on which the steps are placed and joined |
| **Copy to New Job** | makes an ordinary job in the Jobs app from the job of this event |

> [!NOTE]
> A new event is not **Enabled**. Tick it, or nothing happens.

## What the job is given

The job starts with a list of items: the files of the event. One file for **Do event immediately**, all files of the session or batch for the "after" timings. Each item carries the file's name, folder, size and address, and the name of the user. A step such as Copy, PGP or Email then works on every item, as in any job.

A first step **Find** is not needed: the files are there already.

## One job for many events

A job designed inside an event belongs to that event. When several users or several events shall do the same:

1. Design the job once in the Jobs app.
2. In each event, choose that job from the group **Job** of the list. The event then has no job of its own: it hands its files to the job of the Jobs app.

A change in the Jobs app then holds everywhere. **Copy to New Job** is the way from a job that grew inside an event to one in the Jobs app.

## Waiting for the job

**Run Event Asynchronously** in [Timing & Delivery](Users-Events-Editor.md#timing--delivery) decides whether the user waits for the job. A job that is waited for is given up on after the time in the server setting `event_thread_timeout`, in seconds; the job itself goes on.

Let the user wait only where they must see the result, as with a [pre-download event](Users-Events-Pre-Download.md). A job that takes minutes behind an upload makes the upload look stuck.

## Looking at runs

With **Save results of job at end** on, the runs are in the Jobs app and in [Running jobs](Admin-Jobs-Monitor.md), under the name of the event. With **Logging enabled** on, each run has its own log.
