MetaServer > Help > Tasks > Trigger

250-020 MetaServer Tasks – Trigger

Tasks run on a scheduled basis. The schedule is defined by adding one or more triggers. A trigger is like a timer or an event (when MetaServer starts, for example).

Examples of tasks with triggers are:

– Delete old files every day at 9:00.

– Synchronize a SQL tables with a MetaServer database and cleanup the client ID column at 08:00h, 12:00h and 17:00h.

In our example, we will make use of the “CB – SIMPSONS” task. This task is automatically installed with CaptureBites MetaServer.

To add a Trigger, select the action after which you want to insert the Trigger and press Add -> Trigger. The Setup window will automatically open.

You can also open the setup window of an existing Trigger by double-clicking the action or by pressing the setup button on the right side of the Trigger or in the ribbon, as shown below.

In our example case, we want to automatically replicate our “simpsons_guests” database each day at a scheduled time.

To do this, we need to trigger a Sync MetaServer Database action to sync our cleaned up “simpsons_guests” database with the “simpsons_guests_wiki”. Immediately after that, we use a Cleanup MetaServer Database action to clean up the database by deleting any empty records, duplicates, etc.

First, add a description of your trigger.

01 – Run daily at: set the time you want the trigger to be set. You can press the up and down arrow to set the hour and minutes or type it in manually. In this case, we set a daily trigger at 08:00 AM.

02 – Run when MetaServer is running for [x] minutes: instead of a specific time, you can also run a task x minutes after MetaServer has started. You can press the up and down arrow to set the number of minutes or type it in manually.

You typically combine this trigger with the Restart MetaServer action.

TIP: you can copy the current settings and paste them in another setup window of the same type. Do this by pressing the Settings button in the bottom left of the Setup window and by selecting Copy. Then open another setup window of the same type and select Paste.