Table of Contents |
---|
Download
The PowerShell Command Line Interface is available from GitHub at https://github.com/sos-berlin/scheduler-cli-powershell
Short Description
The JobScheduler Command Line Interface (CLI) can be used to control JobScheduler instances (start, stop, status) and job-related objects such as jobs, job chains, orders, tasks.
The JobScheduler CLI module supports Windows PowerShell 3.0 and newer.
Long Description
The JobScheduler Command Line Interface (CLI) is used for the following areas of operation:
...
Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JS-1630 Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JS-1339 Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JS-1620 Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JS-1762
How to get started with the JobScheduler CLI
The JobScheduler CLI is used for JobScheduler instances that are installed
locally or on remote computers and is initialized by the following commands:
- Import Module
PS C:\> Import-Module JobScheduler
- loads the module from a location that is available with the PowerShell module path,
- see
$env:PSModulePath
for predefined module locations.
PS C:\> Import-Module C:\some_module_location\JobScheduler
- loads the module from a specific location, absolute and relative paths can be used.
- Hints
- You can add the command
Import-Module JobScheduler
to your PowerShell profile to have the module loaded on start of a PowerShell session, see PowerShell CLI - Use Cases - Credentials Management
- You can add the command
- Use JobScheduler Master Instance
- As a first operation after importing the module it is required to execute the
Use-JobSchedulerMaster
orUse-JobSchedulerWebService
(starting from release 1.11) cmdlets. PS C:\> Use-JobSchedulerMaster <Url>
orPS C:\> Use-JobSchedulerMaster -Url <Url>
orPS C:\> Use-JobSchedulerWebService -Url
<Url>
-Id
<JobSchedulerId>
- specifies the URL for which the JobScheduler Master or REST Web Service is available. This is the same URL that you would use when opening the JOC Cockpit GUI in your browser, e.g.
http://localhost:4446
. If you omit the protocol (HTTP/HTTPS) for the URL then HTTP will be used. The-Id
parameter specifies the JobScheduler ID of the Master that you intend to connect to. - allows to execute cmdlets for the specified Master independently from the server and operating system that the JobScheduler Master is operated for, i.e. you can use PowerShell cmdlets on Windows to manage a JobScheduler Master running on a Linux box and vice versa. As an exception to this rule you cannot start a remote JobScheduler Master and you cannot start a remote JobScheduler Windows service, however, you can restart, terminate, abort and suspend any JobScheduler Master on any platform.
- specifying the URL is not sufficient to manage the Windows Service of the respective Master, see below.
- specifies the URL for which the JobScheduler Master or REST Web Service is available. This is the same URL that you would use when opening the JOC Cockpit GUI in your browser, e.g.
PS C:\>
Use-JobSchedulerWebService -Url <Url> -Id <JobSchedulerID>
- references the JobScheduler ID that has been assigned during installation of a Master.
- adds the JobScheduler ID to the assumed installation base path.
- A typical base bath would be
C:\Program Files\sos-berlin.com\jobscheduler
- The path is added the subdirectory with the value of the JobScheduler ID
- A typical base bath would be
PS C:\> Use-JobSchedulerMaster -InstallPath <InstallationPath>
- specifies the full installation path, e.g.
C:\Program Files\sos-berlin.com\jobscheduler\scheduler1.10
, for a locally available JobScheduler Master.
- specifies the full installation path, e.g.
PS C:\> Use-JobSchedulerMaster -InstallPath $env:SCHEDULER_HOME
- You can use the environment variable
SCHEDULER_HOME
that points to the installation path. - The JobScheduler CLI module on import checks availability of this environment variable.
- You can use the environment variable
PS C:\> Use-JobSchedulerMaster -Url <Url> -Id <JobSchedulerID>
- specify both URL and JobScheduler ID (recommended).
- determines if the Master with the specified JobSchedulerID is locally available.
- Hints
- If your JobScheduler Master is configured to require HTTP authentication then please consider that
- by default the Windows credentials of the current user are forwarded for web requests.
- individual credentials can be added by use of the following cmdlet
Set-JobSchedulerCredentials
. - For details and examples see PowerShell CLI - Use Cases - Credentials Management
- If your JobScheduler Master is configured to require HTTP authentication then please consider that
- As a first operation after importing the module it is required to execute the
- Manage JobScheduler Objects
PS C:\> Show-JobSchedulerStatus
- shows the summary information for a JobScheduler Master
PS C:\> Get-JobSchedulerOrder
PS C:\> Get-JobSchedulerJobChain
PS C:\> Get-JobSchedulerJob
PS C:\> Get-JobSchedulerTask
- retrieves the list of avaiable objects
- see the complete list of cmdlets with the cmdlet:
Get-Command -Module JobScheduler
How to run JobScheduler commands
JobScheduler commands are Windows PowerShell scripts (.ps1 files), so you can run
them at the command line, or in any editor.
...
Get-Help Use-JobSchedulerMaster -detailed
Get-Help Show-JobSchedulerStatus -detailed
- etc.
Examples
Find some typical use cases for the JobScheduler CLI.
- Perform an emergency stop:
Get-JobSchedulerTask | Stop-JobSchedulerTask
- This will terminate all running and enqueued tasks immediately.
- Find enqueued tasks, i.e. tasks that are scheduled for a later start:
Get-JobSchedulerTask -NoRunningTasks
- Retrieves the list of scheduled tasks.
- Suspend any temporary orders that are e.g. created by job scripts:
$orders = ( Get-JobSchedulerOrder /my_jobs -NoPermanent | Suspend-JobSchedulerOrder )
- This will retrieve temporary ad hoc orders from the
/my_jobs
directory and any subfolders. - All temporary orders are suspended and the list of order objects is stored in a variable.
- Remove orders based on a list that has previously been retrieved:
$orders | Remove-JobSchedulerOrder
- This will remove the orders available from the list.
Managing the JobScheduler Master
Find some use cases for JobScheduler Master management.
- Start the JobScheduler Master:
Start-JobSchedulerMaster -Service
- Starts the Windows service of a JobScheduler Master
- Start the JobScheduler Master in paused mode:
Start-JobSchedulerMaster -Service -Pause
- The Windows service is started and is immediately paused to prevent any tasks from starting.
- Restart the JobScheduler Master:
Restart-JobSchedulerMaster -Timeout 120
- Restarts the Master having left any running tasks up to 120 seconds to complete.
- Stop the JobScheduler Master immediately:
Stop-JobSchedulerMaster -Action kill
- This will kill all running tasks immediately and terminate the JobScheduler Master.
- Stop the JobScheduler Master cluster:
Stop-JobSchedulerMaster -Cluster -Action abort
- Install the JobScheduler Master Windows service:
Install-JobSchedulerService -Start -PauseAfterFailure
- Installs and starts the Windows service. Should a previous JobScheduler run have been terminated with failure then the JobScheduler Master will switch to paused mode.
- This allows e.g. to check for enqueued tasks before starting operations.
- A previously installed Windows service with the same name will be removed.
- Install the JobScheduler Master Windows service for a specific account:
Install-JobSchedulerService -Start -UseCredentials
- This will install the Windows service and ask for the name of the account and password that the service is operated for. The account name typically includes the domain and user, e.g.
.\some_user
forsome_user
in the current domain.
- Remove the JobScheduler Master Windows service:
Remove-JobSchedulerService
- This will remove the Windows service. Should any tasks be running with the JobScheduler Master then the removal will be delayed.
- Consider to use
Stop-JobSchedulerMaster -Action abort
if immediate removal of the Windows service is required.
PowerShell CLI in Detail
- For typical areas of operation see PowerShell CLI - Use Cases
- Full list of JobScheduler cmdlets: PowerShell CLI - Cmdlets
- See the below list of aliases for JobScheduler cmdlets.
Job Management
Get-JobSchedulerJob
Get-JobSchedulerJobHistory
Get-JobSchedulerTask
Start-JobSchedulerExecutableFile
Start-JobSchedulerJob
Stop-JobSchedulerJob
Stop-JobSchedulerTask
Update-JobSchedulerJob
Job Chain Management
Add-JobSchedulerOrder
Get-JobSchedulerJobChain
Get-JobSchedulerOrder
Get-JobSchedulerOrderHistory
Remove-JobSchedulerOrder
Reset-JobSchedulerOrder
Resume-JobSchedulerOrder
Start-JobSchedulerOrder
Suspend-JobSchedulerJobChain
Suspend-JobSchedulerOrder
Update-JobSchedulerJobChain
Update-JobSchedulerOrder
Event Management
Master Managment
Get-JobSchedulerCalendar
Get-JobSchedulerInventory
Get-JobSchedulerStatus
Get-JobSchedulerSystemCredentials
Get-JobSchedulerVersion
New-JobSchedulerHolidays
Restart-JobSchedulerMaster
Resume-JobSchedulerMaster
Send-JobSchedulerCommand
Set-JobSchedulerCredentials
Set-JobSchedulerOption
Show-JobSchedulerCalendar
Show-JobSchedulerStatus
Start-JobSchedulerDashboard
Start-JobSchedulerJobEditor
Start-JobSchedulerMaster
Stop-JobSchedulerMaster
Suspend-JobSchedulerMaster
Use-JobSchedulerAlias
Use-JobSchedulerMaster
Use-JobSchedulerWebService
Agent Managment
Windows Service Management
Change Management References
Jira | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
...