User Tools

Site Tools


reference:scheduler_script

Scheduled Task Script

Note that this functionality is only available in VPOP3 Enterprise

VPOP3 Enterprise can run Lua script periodically to do custom background tasks. It can run a function every minute, 5 minutes, hourly or daily.

The Lua script is stored in a file called scheduler.lua in the VPOP3 directory in VPOP3 v6.6 and earlier, or managed through the Settings → Scripts page in VPOP3 v6.7 and later.

The script is long lasting - ie the script is loaded at start and then functions are called periodically. This mean that script global variables will be maintained between function calls.

Start()

VPOP3 calls this function when the function is first loaded. This function can initialise global variables if necessary.

Unload()
Reload(<data>)

If VPOP3 detects that the script has changed, it will load the new script by calling the Unload() function on the old script, then the Reload() function on the new script. The Unload() function can return a text string which is passed to the Reload() function, allowing global state to be transferred to the new script.

Sched1Min()
Sched5Min()
Sched1Hour()
Sched1Day()

VPOP3 calls these functions at the specified time intervals.

The 1 minute, 5 minute, 1 hour functions are called approximately those times after the previous call of the function, but this is not accurate, so there may be slight time variations.

The 1 day function is called just after midnight every day.

Note that the functions are called one after another, not concurrently, so after VPOP3 has been running for 5 minutes, it will call Sched1Min() then Sched5Min(). It does not call both at the same time.

reference/scheduler_script.txt · Last modified: 2021/08/09 10:55 by paul