Hooks is a mechanism used on Syncrify Server to spawn an external script when a new backup job starts and/or ends. Note: Hooks are supported in Syncrify after build 563.
The value for this parameter line takes a script that should be run whenever a new client initiates backup. It contains variables starting with a dollar sign ($). The following table describes the meaning of each variable:
Variable name | Description |
---|---|
$EVENT | This value can either be true or false It will be true when the script is called when a job is started and false when the script is called when job is complete. |
$CLIENT_IP | IP address of the client |
$CLIENT_BUILD_NO | Build number of the client |
$PROFILE | Name of the profile. If the profile name contains a space, it will be replaced by an underscore. |
$USER | User's email address |
$FILE_COUNT | Total files. This value is always 0 when $EVENT is true. |
$BYTE_COUNT | Total bytes. This value is always 0 when $EVENT is true |
$JOB_ID | An integer representing the job. This number is repeated after Syncrify server is rebooted |
Syncrify is a multi-threaded server. Meaning more than one client can send backup jobs simultaneously. Therefore, you should write your script considering that it can be called simultaneously.
Following examples assume the value for jobHookScript parameter is set to:
Example 1
This script will write space separated data to C:\temp\hookResult.txt
Example 2
This example runs JobStarted.exe when a job starts and JobCompleted.exe when a job ends. In both cases, the .EXE file is passed 3 parameters: Client's IP address, Profile name and user's login.