PLESK EVENT MANAGER

Section 4.2 Register handler

Suppose, that our handler is located in the c:\Program Files\SWsoft\Plesk\admin\bin\ directory (for instance). Let's register it using several SQL queries. You can do that by opening a connection to the machine with running Plesk and starting a MySQL client.

To see the list of available actions:

SELECT * FROM actions;

To find out the ID for a required action ('client_create') (see chapter 4.4. "Example of handler"):

SELECT id FROM actions WHERE name='client_create';

ID will be equal to 1.

Let's register our handler for the 'client_create' (id=1) event, the handler will be executed, for instance, on behalf of the user "Administrator":

mysql> insert into event_handlers (action_id,priority,user,command) values ('1','10','Administrator','"c:\Program Files\SWsoft\Plesk\admin\bin\client_create.exe" "c:\result.txt" "param1" "Param2" "Parameter with spaces" <new_login_name> <new_contact_name>');

If you want to specify one or several handlers more, repeat the actions above for another handler. Note, you can set the handlers execution sequence using the Priority field of the event_handlers table, the handlers are executed in accordance with the priority (lesser value corresponds to a higher priority).

Important: Microsoft Windows does not have any standard mechanism of retrieving arguments transferred to programs. For this reason, implementation of this mechanism is totally up to its developers. We recommend that you follow the rules, used in Microsoft C-runtime library. Also, we do not recommend using the cmd.exe utility for running scripts with parameters, as this utility does not always interpret the transferred parameters correctly.
to top