reference:scheduling_management_scripts

Scheduling Management Scripts

VPOP3 runs a script called scheduler.lua in the background, it will periodically call functions in this script at approximately 1 minute, 5 minute, 1 hour and 1 day intervals. These times are only approximate so should not be relied upon for timing.

The script is loaded when VPOP3 loads and is kept loaded permanently, so global variables etc can be used to maintain state. If the script is edited, then VPOP3 will unload the old script and reload the new script automatically, so any global state will be lost, but different functions are called so the script can pass state to the new version and will know that it has been restarted this way.

You should try not to run long-running scripts in the frequent (1 min/5 min) functions as that will slow down other behaviour of VPOP3. E.g. if you want to go through all users' folders looking for certain messages to delete them, then it may be best to do that hourly or daily, but if you are wanting to do something when a particular message arrives in a particular user's Inbox, performing that every 1 or 5 minutes may be OK.

Functions

Start

VPOP3 calls the Start() function when the script is loaded when VPOP3 starts.

Unload

VPOP3 calls the Unload() function when the script has been changed and the old version is unloaded. This function can return a string value which will be passed to the Reload(str) function later.

Reload

VPOP3 calls the Reload(str) function when the script has been changed and the new version has been loaded. The string value str passed to this function is the return value of the previous Unload() function called earlier (or an empty string if there was no such return value)

Sched1Min

VPOP3 calls the Sched1Min() function approximately every minute. This time is counted from when VPOP3 was started.

Sched5Min

VPOP3 calls the Sched5Min() function approximately every 5 minutes. This time is counted from when VPOP3 was started.

Sched1Hour

VPOP3 calls the Sched1Hour() function approximately every hour. This time is counted from when VPOP3 was started.

Sched1Day

VPOP3 calls the Sched1Day() function approximately every day just after midnight.

reference/scheduling_management_scripts.txt · Last modified: 2018/11/14 10:45 by 127.0.0.1