You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

TOPICh2. about_JobSchedulerh2. SHORT DESCRIPTIONh2. The JobScheduler Command Line Interface (CLI) can be used to controlh2. JobScheduler instances (start, stop, status) and job-related objectsh2. such as jobs, job chains, orders, tasks.h2. The JobScheduler CLI module supports Windows PowerShell 2.0 and above.h2. LONG DESCRIPTIONh2. The JobScheduler Command Line Interface (CLI) is used for the following h2. areas of operation:h2. work as a replacement for the command script .bin\jobscheduler.cmd: h2. provide operations for installing and removing the JobScheduler Windows service h2. starting and stopping JobScheduler instances including active and passive clusters h2. provide bulk operations: h2. select jobs, job chains, orders and tasks h2. manage orders with operations for start, stop and removal h2. terminate tasks h2. schedule jobs and orders: h2. add orders to job chains h2. run PowerShell cmdlets and functions on-the-fly as JobScheduler jobsh2. The JobScheduler CLI provides a number of cmdlets. h2. The complete list of cmdlets is available with the command:h2. Get-Command -Module JobSchedulerh2. Cmdlets come with a full name and a short alias: h2. The full name includes the term "JobScheduler" such as in h2. Use-JobSchedulerMasterh2. Use-Masterh2. Should conflicts occur with existing modules then the aliases can be removed h2. Remove-Item alias:Use-Master h2. Cmdlets consider verbosity and debug settings. h2. This will cause verbose output to be created from cmdlets:h2. $VerbosePreference = "Continue"h2. The verbosity level is reset with: h2. $VerbosePreference = "SilentlyContinue"h2. This will cause debug output to be created from cmdlets: h2. $DebugPreference = "Continue" h2. The debug level is reset with: h2. $DebugPreference = "SilentlyContinue"h2. The responses from a JobScheduler Master can include large XML answers.h2. Such answers are stored in temporary files, the debug message indicates the file name.h2. The threshold for creating files is 1000 bye by default.h2. Consider use of the Set-MaxOutputSize cmdlet to change this value. h2. HOW TO GET STARTED WITH THE JobScheduler CLI? h2. The JobScheduler CLI is used for JobScheduler instances that are installed h2. locally or on remote computers and is initialized by the following commands:h2. Import Module h2. Import-Module JobScheduler h2. makes the module available in a PowerShell session. h2. loads the module from a location that is available with the PowerShell module path, h2. see $env:PSModulePath for predefined module locations.h2. Import-Module c:\some_location\JobSchedulerh2. loads the module from a specific location, absolute and relative paths can be used. h2. Use JobScheduler Master instance h2. Use-Master JobScheduler IDh2. as a first operation after importing the module it is required to execute the Use-Master cmdlet. h2. The JobScheduler ID is determined during setup and is added to the installation path:h2. A typical base bath would be C:\Program Files\sos-berlin.com\jobscheduler h2. The path is added the subdirectory with the name of the JobScheduler IDh2. Use-Master -InstallPath "C:\Program Files\sos-berlin.com\jobscheduler\scheduler110" h2. for local JobScheduler instances the installation path can be specified. h2. Use-Master -InstallPath $env:SCHEDULER_HOME h2. It is recommended to create an environment variable SCHEDULER_HOME that points to the installation path.h2. The JobScheduler CLI module on import checks availability of this environment variable h2. The Use-Master cmdlet is executed automatically if SCHEDULER_HOME is present.h2. Manage JobScheduler objects h2. Show-Status h2. shows the summary information for a JobScheduler Master h2. Get-Order, Get-JobChain, Get-Job, Get-Tasks h2. retrieves the list of avaiable objects h2. see complete list of cmdlets with the cmdlet: Get-Command -Module JobSchedulerh2. HOW TO RUN JobScheduler COMMANDS h2. JobScheduler commands are Windows PowerShell scripts (.ps1 files), so you can run h2. them at the command line, or in any editor.h2. PS C:\> Use-Master scheduler111 h2. Makes the JobScheduler Master with ID "scheduler111" available for use with cmdlets. h2. PS C:\> Show-Status h2. Shows the summary information of a JobScheduler Master.h2. PS C:\> (Get-Task).count h2. Shows the number of tasks that are currently running. h2. PS C:\> Get-Task | Stop-Task h2. Stops all running tasks (emergency stop). h2. PS C:\> $orders = Get-Order /sos h2. Collects the list of orders from a directory and stores it in a variable. h2. For more information about JobScheduler cmdlets, type: Get-Help Use-Master, Get-Help Show-Status etc. h2. EXAMPLES h2. Find some typical use cases for the JobScheduler CLI.h2. Perform an emergency stop:h2. Get-Task | Stop-Task -Action killh2. This will terminate all running and enqueued tasks immediately. h2. Find enqueued tasks, i.e. tasks that are scheduled for a later start: h2. Get-Task -NoRunningTasks h2. Retrieves the list of scheduled tasks.h2. Suspend any temporary orders that are e.g. created by job scripts: h2. $orders = ( Get-Order /my_jobs -NoPermanent | Suspend-Order ) h2. This will retrieve temporary ad hoc orders from the "my_jobs" directory and any subfolders.h2. All temporary orders are suspended and the list of order objects is stored in a variable. h2. Remove orders from a list that have previously been retrieved h2. $orders | Remove-Order h2. This will remove the orders available from the list.h2. MANAGING THE JobScheduler MASTER h2. Find some use cases for JobScheduler Master management. h2. Start the JobScheduler Master: h2. Start-Master -Service h2. Starts the Windows service of a JobScheduler Master h2. Start the JobScheduler Master in paused mode: h2. Start-Master -Service -Pause h2. The Windows service is started and immediately paused to prevent any tasks from starting. h2. Restart the JobScheduler Master: h2. Restart-Master -Timeout 120 h2. Restarts the Master having left any running tasks up to 120 seconds to complete. h2. Stop the JobScheduler Master immediately: h2. Stop-Master -Action kill h2. This will kill all running tasks immediately and terminate the JobScheduler Master. h2. Stop the JobScheduler Master cluster: h2. Stop-Master -Cluster -Action aborth2. Install the JobScheduler Master Windows service: h2. Install-Service -Start -PauseAfterFailure h2. Installs and starts the Windows service. Should a previous JobScheduler runh2. have been terminated with failure then JobScheduler Master will switch to pause mode.h2. This allows e.g. to check for enqueued tasks before starting operations.h2. A previously installed Windows service with the same name will be removed.h2. Install the JobScheduler Master Windows service for a specific account: h2. Install-Service -Start -UseCredentials h2. This will install the service and ask for the name of the account and passwordh2. that the service is operated for. The account name typically includes theh2. domain and user, e.g. .\some_user for "some_user" in the current domain.h2. Remove the JobScheduler Master Windows service: h2. Remove-Service h2. This will remove the Windows service. Should any tasks be running with theh2. JobScheduler Master then the removal will be delayed. Consider to use h2. Stop-Master -Action abort h2. if immediate removal of the Windows service is required. h2. SEE ALSOh2. JobScheduler wiki: https://kb.sos-berlin.com/display/PKB/JobSchedulerh2. Get-Calendarh2. Get-Jobh2. Get-JobChainh2. Get-Orderh2. Get-Statush2. Get-Taskh2. Get-Versionh2. Install-Serviceh2. Remove-Orderh2. Remove-Serviceh2. Reset-Orderh2. Restart-Masterh2. Resume-Masterh2. Resume-Orderh2. Send-Commandh2. Set-MaxOutputSizeh2. Show-Calendarh2. Show-Statush2. Start-Masterh2. Start-Jobh2. Start-Orderh2. Stop-Jobh2. Stop-Masterh2. Stop-Taskh2. Suspend-Masterh2. Suspend-Orderh2. Update-Jobh2. Update-Orderh2. Use-Master

  • No labels