VMmanager Documentation (user)

Creating a script for the VM

ISPSystem

Scripts allow you to set up virtual machines automatically: install software applications, modify configuration files, and perform other operations. Scripts from the ISPsystem repository are available per default.

On a Linux OS, you can run Shell scripts written in bash, and on a Windows OS, you can run Powershell scripts.

You can set parameters for the script. Their values will need to be entered or selected from the list when running the script. Variables can be used as parameters to be entered manually. Then, when the script is run, the value of the variable will be displayed in the parameter input field. 

Note

The value of the built-in PASS variable, which contains the root password, cannot be changed when running the script. Use your own variable or parameter to pass the password to the script.

Creating a script


To create a script:

  1. Go to Scripts → Create a script.
  2. Enter a script Name.
  3. Specify a Description. It is displayed in the script list.
  4. Specify Filters to run the script. The script is available to run on a VM if the conditions of all filters match. The OS tags filter is mandatory, the others are optional.
  5. If necessary, specify the requested script parameters:
    1. Press Add parameter .
    2. Specify the parameter Name and Description . If you use a variable name as a parameter, its description will be added automatically.

    3. You can specify parameter values that will be offered when the script is run. To do this, click Add:
      1. Specify Parameter value and Describe value.
      2. To add more parameters , press Add one more value. In the right part of the window you can see how the parameter selection form will look like.  

        Example of the form

      3. Press Add.
    4. For a mandatory parameter, enable the Required option.
    5. To add more parameters to the script, press Add one more parameter to script.
  6. Select a Script type:
    • Shell script — for Linux OS;
    • Powershell script — for Windows OS.
  7. Enter the Script in the editor window. To expand the editor window to the full screen, press . To return to the window mode, press . The editor has an auto-complete feature. For example, if you need to insert in a script the name of an external variable, start typing and the editor will suggest endings.
  8. To send an email to the user after running the script, press Add in the Notification to email section.
  9. By default, you are offered to set up an English email template — Email for EN.
  10. Enter the Email subject.
  11. Next, specify the content of the email in the Content field. In this field, you can use the same variables and parameters that you used in the script. Read more about creating email templates in Email templates in scripts.
  12. Click Preview to preview the email.
  13. If you need an email template in Russian, press Add the email for RU. If you no longer need any of the templates, press Delete the email for RU / Delete the email for EN.
  14. Click on Create.

Operations with scripts


To change script settings, go to Scripts → select script → menu → Edit.
To run the script on a VM, enter Virtual machines → select the VM →   menu → Run script → select the script → enter the script parameters → Run .

To interrupt execution of the script, press  image2021-2-9_10-22-27.png in the VM card or the task queue.

Thank you for your feedback!
Was the article useful?
Tell us why not:

it does not match the title

it was hard to understand

I didn't find the answer

recommendations from the article did not help

other

Tell us what you didn't like in the article: