Difference between revisions of "Documentation/Scripts/Adding Scripts"

From ScriptRunner
Jump to: navigation, search
(Created page with " ''' Documentation :: Scripts:: Adding Scripts''' For a script to be run by ScriptRunner, either manually by a user or as part of a schedule, its location and arguments nee...")
 
Line 21: Line 21:
 
**'''Timeout''': The amount of time a script can be executing for until a notification is raised to say it has been running too long.
 
**'''Timeout''': The amount of time a script can be executing for until a notification is raised to say it has been running too long.
 
**'''Enabled''': Keep this box checked to ensure the script is visible to users. Disabled scripts will not show on the Run Scripts screen, or in any script selection boxes such as when managing scheduled scripts.
 
**'''Enabled''': Keep this box checked to ensure the script is visible to users. Disabled scripts will not show on the Run Scripts screen, or in any script selection boxes such as when managing scheduled scripts.
 +
**'''Reference Required''': Indicates if any user running this script should provide a incident or change record to reference against.
 +
**'''Log Retention Days''': How many days to store the output of the script in the database.
 +
 +
* Scripts can take any number of arguments required. It's important that you provide them in the order your script or application is expecting. Arguments will be passed to your script in the order shown in the Script Arguments section of the Create Script window, from top to bottom.<br />To add a script argument, click [[File: addNewArgument.png ]]. This will create a new argument at the bottom of the list of arguments.<br /><br />
 +
**'''Number''': Indicates the order in which the arguments will be passed to your script or application.
 +
**'''Name''': A name to describe what this argument is. This name is displayed to users running scripts.
 +
**'''Description''': A further description to what the argument is for. This field is provided more space on the Run Script screen and is shown to users when running scripts too.
 +
**'''Prefix''': If the argument requires a static prefix before providing the the users input, the this can be provided here. This will technically be passed as another argument to your script or application, and always be position prior to what the user running your script inputs. For example, if your script or application

Revision as of 01:23, 18 July 2020


Documentation :: Scripts:: Adding Scripts

For a script to be run by ScriptRunner, either manually by a user or as part of a schedule, its location and arguments need to be defined first. Although we refer to scripts throughout, ScriptRunner can run any desired executable that doesn't need to launch a graphical window.


Adding a New Script

  • From the menu, select Manage Scripts.
  • Click NewButton.png.
  • The Create Script window should now be shown.

    CreateScript.png

    • Name: A descriptive name to give your script to reference it in other areas of ScriptRunner.
    • Description: A further description of your script, shown to users when selecting scripts to run.
    • Group: When scripts are displayed in ScriptRunner they are often grouped together. This selects the group the script resides within.
    • Host: Select the host the script should run on. See Script Hosts for more information.
    • Script Locatoin: The full path of the script or application you wish to execute.
    • Maximum Return Code: The highest return code allowed to be returned by the script for it to accepted as successfully running. A return code higher than this value will mark the running of the script as 'ERROR' on completion, and trigger notifications of a failure if scheduled.
    • Timeout: The amount of time a script can be executing for until a notification is raised to say it has been running too long.
    • Enabled: Keep this box checked to ensure the script is visible to users. Disabled scripts will not show on the Run Scripts screen, or in any script selection boxes such as when managing scheduled scripts.
    • Reference Required: Indicates if any user running this script should provide a incident or change record to reference against.
    • Log Retention Days: How many days to store the output of the script in the database.
  • Scripts can take any number of arguments required. It's important that you provide them in the order your script or application is expecting. Arguments will be passed to your script in the order shown in the Script Arguments section of the Create Script window, from top to bottom.
    To add a script argument, click File:AddNewArgument.png. This will create a new argument at the bottom of the list of arguments.

    • Number: Indicates the order in which the arguments will be passed to your script or application.
    • Name: A name to describe what this argument is. This name is displayed to users running scripts.
    • Description: A further description to what the argument is for. This field is provided more space on the Run Script screen and is shown to users when running scripts too.
    • Prefix: If the argument requires a static prefix before providing the the users input, the this can be provided here. This will technically be passed as another argument to your script or application, and always be position prior to what the user running your script inputs. For example, if your script or application