Example: Use scripting to create and configure schedulers
Use the wsadmin scripting tool to invoke a Jacl script and create a SchedulerConfiguration resource.
The following Jacl example script can be invoked using wsadmin.sh, which creates a SchedulerConfiguration resource using the DefaultWorkManager at the server scope.
# Example JACL Script to create a SchedulerConfiguration # at the server scope # Change the cell, node and server to match the environment set cellName MyCell set nodeName MyNode set serverName server1 # We can just grab the first provider, since there is only one at the # server scope level. set schedProv [$AdminConfig getid /Cell:$cellName/Node:$nodeName/Server:$serverName/SchedulerProvider:SchedulerProvider] if {$schedProv == ""} { puts "Unable to find SchedulerProvider for server: $serverName. Aborting." exit } puts "Found a SchedulerProvider" # Create a WorkManager for our scheduler at the server scope. # We could use any of the other scopes as long as it is at the same # or higher than the Scheduler's scope. set wrkMgrProv [$AdminConfig getid /Cell:$cellName/Node:$nodeName/Server:$serverName/WorkManagerProvider:WorkManagerProvider/] if {$wrkMgrProv == ""} { puts "Unable to find the WorkManagerProvider for server: $serverName. Aborting." exit } puts "Found a WorkManagerProvider" set wmName "MyScheduler WorkManager" set wmJNDIName "wm/MySchedWorkManager" set wmIsGrowable false set wmMaxThreads 1 set wmMinThreads 0 set wmNumAlarmThreads 10 set wmServiceNames "com.ibm.ws.i18n;security;UserWorkArea;zos.wlm" set wmThreadPriority 5 # Setup our DefaultWorkManager attributes set createAttrs [subst { \ {isGrowable $wmIsGrowable} \ {jndiName $wmJNDIName} \ {maxThreads $wmMaxThreads} \ {minThreads $wmMinThreads} \ {name "$wmName"} \ {numAlarmThreads $wmNumAlarmThreads} \ {serviceNames "$wmServiceNames"} \ {threadPriority $wmThreadPriority} }] puts "Creating a WorkManager" $AdminConfig create WorkManagerInfo $wrkMgrProv $createAttrs puts "WorkManager Created" # Setup our SchedulerConfiguration attributes set schedulerName MyScheduler set schedulerJNDIName sched/MyScheduler set datasourceJNDIName jdbc/MySchedulerDatasource set datasourceAlias MySchedulerAlias set pollInterval 30 set tablePrefix MSCD set useAdminRoles true set createAttrs [subst { \ {name $schedulerName} \ {datasourceJNDIName $datasourceJNDIName} \ {datasourceAlias $datasourceAlias} \ {jndiName $schedulerJNDIName} \ {pollInterval $pollInterval} \ {tablePrefix $tablePrefix} \ {useAdminRoles true} \ {workManagerInfoJNDIName $wmJNDIName}}] puts "Creating a Scheduler" $AdminConfig create SchedulerConfiguration $schedProv $createAttrs puts "Scheduler created" # Save the configuration $AdminConfig save
Related tasks
Configure schedulers using JMX Use wsadmin scripting Reference topic