Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The JobScheduler Command Line Interface (CLIJCLI) can be used to control
JobScheduler instances (start, stop, status) and job-related objects
such as jobs, job chains, orders, tasks.

...

The JobScheduler Command Line Interface (CLIJCLI) is used for the following
areas of operation:

...

The responses from a JobScheduler Master can include large XML answers.
Such answers are stored in temporary files, the debug message indicates the file name.
The threshold for creating files is 1000 bye by default.
Consider use of the Set-MaxOutputSize cmdlet to change this value.

...

  • Import Module
    • Import-Module JobScheduler
      • makes the module available in a PowerShell session.
      • loads the module from a location that is available with the PowerShell module path,
      • see $env:PSModulePath for predefined module locations.
    • Import-Module c:\some_module_location\JobScheduler
      • loads the module from a specific location, absolute and relative paths can be used.
  • Use JobScheduler Master instanceInstance
    • Use-Master JobSchedulerID
      • as a first operation after importing the module it is required to execute the Use-Master cmdlet.
      • The JobScheduler ID is determined during setup and is added to the installation path:
        • A typical base bath would be C:\Program Files\sos-berlin.com\jobscheduler
        • The path is added the subdirectory with the name of the JobScheduler ID
    • Use-Master -InstallPath "C:\Program Files\sos-berlin.com\jobscheduler\scheduler110"
      • for local JobScheduler instances the installation path can be specified.
    • Use-Master -InstallPath $env:SCHEDULER_HOME
      • It is recommended to create an environment variable SCHEDULER_HOME that points to the installation path.
      • The JobScheduler CLI module on import checks availability of this environment variable
      • The Use-Master cmdlet is executed automatically if SCHEDULER_HOME is present.
  • Manage JobScheduler objectsObjects
    • Show-Status
      • shows the summary information for a JobScheduler Master
    • Get-Order, Get-JobChain, Get-Job, Get-Tasks
      • retrieves the list of avaiable objects
    • see complete list of cmdlets with the cmdlet: Get-Command -Module JobScheduler

HOW TO RUN JobScheduler COMMANDS

...

  • Makes the JobScheduler Master with ID scheduler111 available for use with cmdlets.
    • PS C:\> Use-Master scheduler111
  • Show Shows the summary information of a JobScheduler Master.
    • PS C:\> Show-Status
  • Show Shows the number of tasks that are currently running.
    • PS C:\> (Get-Task).count
  • Stop Stops all running tasks (emergency stop).
    • PS C:\> Get-Task | Stop-Task
  • Collect Collects the list of orders from a directory and stores it in a variable.
    • PS C:\> $orders = Get-Order /sos

For more information about JobScheduler cmdlets, type: Get-Help Use-Master -detailed, Get-Help Show-Status -detailed etc.

...

  • Perform an emergency stop:
    • Get-Task | Stop-Task -Action kill
    • This will terminate all running and enqueued tasks immediately.
  • Find enqueued tasks, i.e. tasks that are scheduled for a later start:
    • Get-Task -NoRunningTasks
    • Retrieves the list of scheduled tasks.
  • Suspend any temporary orders that are e.g. created by job scripts:
    • $orders = ( Get-Order /my_jobs -NoPermanent | Suspend-Order )
    • 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 from based on a list that have has previously been retrieved:
    • $orders | Remove-Order
    • This will remove the orders available from the list.

...

  • Start the JobScheduler Master:
    • Start-Master -Service
    • Starts the Windows service of a JobScheduler Master
  • Start the JobScheduler Master in paused mode:
    • Start-Master -Service -Pause
    • The Windows service is started and is immediately paused to prevent any tasks from starting.
  • Restart the JobScheduler Master:
    • Restart-Master -Timeout 120
    • Restarts the Master having left any running tasks up to 120 seconds to complete.
  • Stop the JobScheduler Master immediately:
    • Stop-Master -Action kill
    • This will kill all running tasks immediately and terminate the JobScheduler Master.
  • Stop the JobScheduler Master cluster:
    • Stop-Master -Cluster -Action abort
  • Install the JobScheduler Master Windows service:
    • Install-Service -Start -PauseAfterFailure
    • Installs and starts the Windows service. Should a previous JobScheduler run have been terminated with failure then JobScheduler Master will switch to pause 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-Service -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 for "some_user" in the current domain.
  • Remove the JobScheduler Master Windows service:
    • Remove-Service
    • This will remove the Windows service. Should any tasks be running with the JobScheduler Master then the removal will be delayed. 
    • Consider to use Stopuse Stop-Master -Action abort if abort if immediate removal of the Windows service is required.

...