©XSIBackup-Free: Free Backup Software for ©VMWare ©ESXi

Forum ©XSIBackup: ©VMWare ©ESXi Backup Software


You are not logged in.

#1 2021-06-11 06:12:43

Mathieu
Member
Registered: 2021-04-20
Posts: 7

Details on the --on-success and --on-error options

manual wrote:

The --on-error and --on-success arguments allow to execute/trigger other backup jobs present in the /jobs folder or external programs upon backup completion.

You can trigger a job in the /jobs folder by referencing its Id, like this:

--on-success="backupId->009" (remember to enclose between double quotes).

Or you can execute any external program present in the ESXi shell like this:

--on-success="execProg->/vmfs/volumes/datastore1/xsi-dir/my-script.sh"

[...]

Please, be aware that you can also treat external programs as if they were jobs by simply placing the script inside the jobs folder and assigning it a three digit file name. Then just call the script as if it were a regular job.

This more general approach, which has been introduced with version 11 will lead to deprecating the execProg-> switch in short. So you should place scripts inside the jobs folder and name them with a three digit string. It is recommended to name scripts 700 to 800 to better identify them when needed.


Is it possible to give parameters to a script run as the result of the --on-success or --on-error option ?

Like

 --on-success="backupId->700 parameter" 

Or

 --on-success="execProg->/path/to/my/script/my-script.sh parameter" 

And would it be possible to directly give a 1 line script instead of a job id or a script file name ?

Like

 --on-success="backupId->rm file" 

Or

 --on-success="execProg->rm file" 

Offline

#2 2021-06-11 15:17:14

admin
Administrator
Registered: 2017-04-21
Posts: 1,825

Re: Details on the --on-success and --on-error options

Those are in the end fake options for users not willing to understand the details of how the Bash shell works.

If you are planning to do more elaborated things like the ones you are describing, then forgetting about --on-* arguments is a must.

(c)XSIBackup-Pro Classic is in the end a shell script, you can interact with it as such and pass whatever arguments you want, or just query the outcome of the script execution and take appropiate action in each case: error | success

Offline

#3 2021-06-16 03:58:22

Mathieu
Member
Registered: 2021-04-20
Posts: 7

Re: Details on the --on-success and --on-error options

How would you recommend to query the outcome of the script execution ?

I understand that the exit code is always 137 because of the kill signal used at the end of the script, and therefore cannot be used to determine if any error occurred during the execution of the script.

Offline

#4 2021-06-16 08:32:36

admin
Administrator
Registered: 2017-04-21
Posts: 1,825

Re: Details on the --on-success and --on-error options

(c)XSIBackup Classic is a script, you have full access to the code and permission to modify it, just as long as you don't redistribute the changes. Set your own flag based on your requirements or reuse/modify the very --on-* functions.

Offline

Board footer