.. _Managing Cluster Resources with Scripts:

Managing Cluster Resources with Scripts
---------------------------------------

Virtuozzo Storage comes with a number of scripts used by the ``shaman`` utility to manage and monitor cluster resources. There are two types of scripts:

-  Common scripts. The common scripts are located in the ``/usr/share/shaman`` directory and used by the ``shaman`` utility to call resource-specific scripts.

-  Resource-specific scripts. For each common script, there are one or more resource-specific scripts. Resource-specific scripts are peculiar to each cluster resource and located in separate subdirectories. For virtual machines and containers, these directories are ``/usr/share/shaman/vm-`` and ``/usr/share/shaman/ct-``, respectively. Resource-specific scripts are used to perform various actions on cluster resources.

The following example describes the process of using the relocate script:

1. The ``shaman-monitor`` daemon checks at regular intervals whether some virtual machines and containers require relocation (usually, when a server fails and the virtual machines and containers hosted on it should be relocated to a healthy server).

2. If some virtual machines or containers are scheduled for relocation, ``shaman-monitor`` calls the common script ``/usr/share/shaman/relocate``.

3. The common script ``relocate`` calls the scripts ``/usr/share/shaman/vm-/relocate`` and ``/usr/share/shaman/ct-/relocate`` to relocate the virtual machines and containers to a healthy server.

If necessary, you can customize any of the scripts to meet your demands.

For the full list of scripts and their descriptions, see the ``shaman-scripts`` man page.

