...
- JobScheduler supports VBScript for implementation of jobs:
- support for VBScript with a Master is available since long
- support for VBScript with Agents is available with
Jira |
---|
server | SOS JIRA |
---|
columns | key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution |
---|
serverId | 6dc67751-9d67-34cd-985b-194a8cdc9602 |
---|
key | JS-1623 |
---|
|
- The support for VBScript includes Shell jobs and API jobs:.
- Some minor differences exist between VBScript jobs for Master and Agents, see Compatibility between PowerShell VBScript and ShellScriptControl:VBScript.
- VBScript jobs are configured with
<script language="VBScript">
for execution with a Master<script language="ScriptControl:VBScript">
for execution with Agents.
...
Display feature availability |
---|
StartingFromRelease | 1.10.5 |
---|
|
Examples
Example: Simple VBScript Job
Example 1: A simple VBScript job with some scripting similar to shell jobs might look like this:
Code Block |
---|
language | vb |
---|
title | Simple VBScript Job |
---|
collapse | true |
---|
|
<x<?xml version="1.0" encoding="ISO-8859-1"?>
<job process_class="my_Agent">
<script language="scriptcontrol:vbscript">
<![CDATA[
Function spooler_process()
spooler_log.info( spooler_job.name() )
spooler_log.info( ".. merge parameters" )
Set parameters = spooler_task.params()
parameters.merge( spooler_task.order().params() )
spooler_log.info( "parameter name1=" & parameters.value( "name1" ) )
spooler_log.info( "parameter name2=" & parameters.value( "name2" ) )
spooler_process = false
End Function
]]>
</script>
<run_time />
</job> |
Example: VBScript Job for order API methods
Example 1: A simple VBScript job with some scripting similar to shell jobs might look like this:
Code Block |
---|
language | vb |
---|
title | VBScript Job for order API methods |
---|
collapse | true |
---|
|
<job process_class="Agent_Windows" stop_on_error="no" order="yes">
<params >
<param name="name1" value="value1"/>
</params>
<script language="powershellscriptcontrol:vbscript">
<![CDATA[
spooler_log.info( "id: " & spooler_task.order.id() )
spooler_log.info( "title: " & spooler_task.order.title() )
spooler_log.info( "state: " & spooler_task.order.state() )
spooler_log.info( "end state: " & spooler_task.order.end_state() )
Set jobChain = spooler_task.order.job_chain()
spooler_log.info( "job chain name: " & jobChain.name() )
spooler_task.order.set_state_text( "current state text" )
spooler_log.info( "state text: " & spooler_task.order.state_text() )
spooler_log.info( "next start time: " & spooler_task.order.string_next_start_time() )
spooler_log.info( "priority: " & spooler_task.order.priority() )
spooler_log.info( "suspended: " & spooler_task.order.suspended() )
spooler_log.info( "is Service: " & spooler.is_service() )
Set myJobChain = spooler_task.order.job_chain()
spooler_log.info( "job chain name: " & myJobChain.name() )
Set myParams = spooler_task.order.params()
spooler_log.info( "parameter name1=" & myParams.value( "name1" ) )
Set myVariables = spooler_task.order.params()
spooler_log.info( "params count: " & myVariables.count() )
myVariableNames = split( myVariables.names(), ";" )
For i = LBound(myVariableNames) to UBound(myVariableNames)
spooler_log.info( "variable " & myVariableNames(i) & ": " & spooler_task.order.params.var( myVariableNames(i) ) )
Next
spooler_log.info( "order xml: " & spooler_task.order.xml() )
]]>
</script>
<run_time />
</job> |
Example: VBScript Job
Example 1: A simple VBScript job with some scripting similar to shell jobs might look like this:
Code Block |
---|
<?xml version="1.0" encoding="ISO-8859-1"?>
<job process_class="my_Agent">
<script language="scriptcontrol:vbscript">
<![CDATA[
Function spooler_process()
spooler_log.info( spooler_job.name() )
spooler_log.info( ".. merge parameters" )
Set parameters = spooler_task.params()
parameters.merge( spooler_task.order().params() )
spooler_log.info( "parameter name1=" & parameters.value( "name1" ) )
spooler_log.info( "parameter name2=" & parameters.value( "name2" ) )
spooler_process = false
End Function
]]>
</script>
echo "job is starting"
# pause the job for 10 seconds
Start-Sleep -Seconds 10
# list files in a directory
$files = dir *
echo $files
# execute some Windows command script
/tmp/some_batch_script.cmd
echo "job is finishing"
]]>
</script>
<run_time />
</job>xjob> |
Anchor |
---|
| vbscript_scriptcontrol |
---|
| vbscript_scriptcontrol |
---|
|
Compatibility between VBScript and ScriptControl:VBScript