| Syntax | $backgroundProcess.create{name}{delay}{script_to_exec}{parameters} |
| Documentation | Create a background process. Note that the background process will later be executed under the user context of which created it.
2 - delay, a positive non zero integer number of seconds to wait between successive executions of the template specified in parameter 3. 3 - template, the script whos contents are to be executed by every successive call. 4 - parameters (optional); You can give parameters here which can be evaluated by the background process script excactly as if they'd be coming via normal HTTP GET or POST. The notation is as you'd give them in an URL. |
| Examples | |
| $if{$backgroundProcess.inExecution{$getCurrent{bpname}{}}}{
$/* recursive template, now in backgroundprocess execution $*/
$if{$equals{0}{$random{0}{1}}}{$throw{java.lang.RuntimeException}{just testing...don't panic!}}
}
{
$set{name}{xray_$time.getUnique{}}
$backgroundProcess.create{$get{name}}{1}{$getCurrent{t}}{bpname=$get{name}&testparam1=hello&testparam2=you}
$commit{NONE}
$sleep{5000}
$begin{UPDATE}
Backgroundprocess properties: Name: $get{name} Exists: $if{$backgroundProcess.exists{$get{name}}}{Yes}{No} Delay: $backgroundProcess.getDelay{$get{name}} Error count: $backgroundProcess.getErrorCount{$get{name}} Execution count: $backgroundProcess.getExecutionCount{$get{name}} Last end: $backgroundProcess.getLastEndTime{$get{name}} Last error: $backgroundProcess.getLastError{$get{name}} Last start: $backgroundProcess.getLastStartTime{$get{name}} Parameters: $getHTMLViewable{$backgroundProcess.getParameters{$get{name}}} Template: $backgroundProcess.getTemplate{$get{name}} $backgroundProcess.remove{$get{name}} } |
|
| Group | Special |
| Minimum required transaction-mode: | UPDATE=TREE |
| Required scripting permission of the developer | PERMISSION_FL_ADVANCED |
| Minimum parameters | 3 |
| Maximum parameters | 4 |