Configure per-job scripts
Posted by Sven Koester on 16 April 2007 7:41
Archiving or saving files may require some user or site-specific additional preparation steps.
For example:

  • A database server may have to be told to flush the database files
  • A notification may need to be send to a user to close all open files


To automate such tasks, PresSTORE allows you to execute a script before job is run and immediately after the job is finished. The script depends on the machine architecture. On Windows, the script must be a windows program or a batch file. On a Unix-like system (Linux, Mac, Solaris), the script may be a shell script or an executable program.

The scripts can be added in the following places:

Backup Plans -> [double-click your backup plan] ->
[double-click a client on the select window] -> Additional Options:

Execute script before backup:
[add absolute path to the script and optional arguments here]

Execute script after backup:
[add absolute path to the script and optional arguments here]


Synchronize Plans ->
[double-click your synchronize plan] -> Additional Options:

Pre-synchronize script:
[add absolute path to the script and optional arguments here]

Post-synchromize script:
[add absolute path to the script and optional arguments here]


Archive Plans ->
[double-click your archive plan] -> Additional Options:

Execute script before archive:
[add absolute path to the script and optional arguments here]

Execute script after archive:
[add absolute path to the script and optional arguments here]


The format of the entry is simple: the absolute path of the script/program to execute, followed by any number of optional arguments:

/path/of/the/script arg1 arg2 ... argN

If the absolute path of the script contains blank charachters, it is necessary to enclose the path in curly braces:

{/path/of/my scripts/script} arg1 arg2 ...argN

The arg1, arg2 ... argN are variable number of optional user arguments passed to the script at execution time. The specified script is executed on the machine where data to be processed (backuped, archived, synced) is located. This is most logical and common case.
Rarely, you would need to execute a script on some other machine. In such cases you need to prefix the script with the client-name prefix.
Examples:
To stop and start a database on a client before backing it up, enter:
/etc/rc.d/rc3.d/my_database stop (in the pre-script field)
/etc/rc.d/rc3.d/my_database start (in the post-script field)

In order to perform a script on another machine, e.g. because the database is running on a client2 but uses files on the one that is due to backup, one may prefix the other client name:
client2:/etc/rc.d/rc3.d/my_database stop (in the pre-script field)
client2:/etc/rc.d/rc3.d/my_database start (in the post-script field)

Please keep in mind that the client name is the name configured in PresSTORE, not the hostname used on the operating system level. Also, the script must be physically located on the given client. PresSTORE interprets (and acts upon) the error reported from the script/program. The script must exit with the return code 0 (zero) and must not generate output to 'Standard Error', otherwise PresSTORE assumes that an error has occurred and acts accordingly. For pre-scripts terminating in error, the entire job is aborted. For post-scripts terminating in error, the job completion status is marked as exception, althugh the job itself may have been done OK.

NOTE: Pre- or post-scripts won't be executed for jobs that are being launched manually - only for scheduled jobs.

(1278 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).

ERROR: This domain name (portal.archiware.com), does not match the domain name in the license key file support.archiware.com.

For assistance with your license, please contact the Kayako support team: https://support.kayako.com