For instance, let's create an event handler for the 'client account creation' event. The handler will accept a client name as the first parameter, and the client's login as the second. For simplicity we will use a shell-script called test-handler.sh that looks as follows:
----------------------------------------------------------------------
#!/bin/bash
echo "--------------" >> /tmp/event_handler.log
/bin/date >> /tmp/event_handler.log # information on the event date and time
/usr/bin/id >> /tmp/event_handler.log # information on the user, on behalf of which the script was executed (to ensure control)
echo "client created" >> /tmp/event_handler.log # information on the created client account
echo "name: $1" >> /tmp/event_handler.log # client's name
echo "login: $2" >> /tmp/event_handler.log # client's login
echo "--------------" >> /tmp/event_handler.log
----------------------------------------------------------------------
This script prints some information to a file so that we could control its execution (we cannot output information to stdout/stderr, as the script is executed in the background mode).
After registering of this handler, if you log in to your Plesk control panel and create a new client, specifying the Some Client value in the Contact name field, and some_client in the Login field, the handler will be invoked, and the following records will be added to the /tmp/event_handler.log:
--------------
Sat Jun 26 21:46:34 NOVT 2004
uid=0(root) gid=0(root) groups=0(root)
client created
name: Some client
login: some_client
--------------
If you want to specify one or few handlers more, repeat the actions above for another handler.