Comprehensive data protection for all workloads
Post Reply
martinuy
Novice
Posts: 8
Liked: 3 times
Joined: Oct 07, 2020 4:43 pm
Full Name: Martin Gonzalez
Contact:

Help with Surebackup Custom Script

Post by martinuy »

Dear all, i need your help.

We have a Application Group with one Linux Centos 7 with a MySQL database. I need to check un the surebackup job is the MySQL is up. i have to Script, one in the VBS and the other local in the Centos VM. We are using plink to connecto remotely to de VM and execute de bash and this script return 0 is the Service is Up or 1 is the Service is Down.
When execute de script manually, we have the result in the %errorLevel% variable of the SO, and return in the prompt 0 or 1, but when i attach de script in the Appication Group in the VM, the job execute correctly but thi process "Running test script" dont stop, is running always and de unique solution to stop de virtual data labs is Restart de VBS and delete de orphaned data in de VBS Database.

This is the line in de .bat File:
@echo on
C:\temp\Putty\plink.exe -i C:\temp\Putty\PrivateKey.ppk -l mysql xx.xx.xx.xx -m C:\temp\Putty\Command.txt

in the file Command.txt

cd /home/mysql
./check_mysql_status.sh

The question is, what does Job expect to receive and where do I define how he should receive it?

Thanks a lot for your help.

Martin.
PetrM
Veeam Software
Posts: 3626
Liked: 608 times
Joined: Aug 28, 2013 8:23 am
Full Name: Petr Makarov
Location: Prague, Czech Republic
Contact:

Re: Help with Surebackup Custom Script

Post by PetrM »

Hi Martin,

The script specified in verification options must return 0 if it is passed successfully so my only guess is that you're missing "exit 0" line in your .bat file.

Thanks!
tdewin
Veeam Software
Posts: 1818
Liked: 655 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:

Re: Help with Surebackup Custom Script

Post by tdewin » 1 person likes this post

Btw we have a surebackup / mysql script on VeeamHub: https://github.com/VeeamHub/powershell/ ... MySQLCheck . It uses the mysql dotnet connector so you can do real queries against the database (so it's another level of checking)

If you want to verify via SSH only, there is also an example that uses the Rensi Library that ships with B&R by default : https://github.com/VeeamHub/powershell/ ... shtest.ps1
martinuy
Novice
Posts: 8
Liked: 3 times
Joined: Oct 07, 2020 4:43 pm
Full Name: Martin Gonzalez
Contact:

Re: Help with Surebackup Custom Script

Post by martinuy »

Thanks Petr for you response, I tray explicit exit 0 and exit /b %ERRORLEVEL% in the .bat file with no success. We tray now with the powershell script thats suggest Timothy but i need to modify this because the authenticating to de database is using a private key.

I try the SSH thats use Rensi Library but, dont works. with the error:

Code: Select all

Get-ItemPropertyValue : Requested registry access is not allowed.
At C:\Users\mgonzalez\Desktop\BR-Surebackup-MySQLCheck\br-surebackup-mysqlcheck.ps1:16 char:14
+ ... corepath = (Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Veeam\Veeam B ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-ItemPropertyValue], SecurityException
    + FullyQualifiedErrorId : System.Security.SecurityException,Microsoft.PowerShell.Commands.GetItemPropertyValueCommand
 
Test-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Users\mgonzalez\Desktop\BR-Surebackup-MySQLCheck\br-surebackup-mysqlcheck.ps1:18 char:15
+ if (Test-Path $dll) {
+               ~~~~
    + CategoryInfo          : InvalidData: (:) [Test-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.TestPathCommand
Im continue searching for a solution because the Veeam Support dont help with this.

Thanks a lot.
martinuy
Novice
Posts: 8
Liked: 3 times
Joined: Oct 07, 2020 4:43 pm
Full Name: Martin Gonzalez
Contact:

Re: Help with Surebackup Custom Script

Post by martinuy » 2 people like this post

Resolve de problem. The script is executed with the system-account, this user dont have de SSH Key listed in the registry. We export and import de registry SSH Key to the system-account and the Surebackup job execute ok.

The registry to export is:
[HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\SshHostKeys]
All the SSH keys is in there.

And import in the user you use for the Services of VBR.

Other option is logging to the VBR Server with de Service User and open a Putty to the Server.

Regards.
Post Reply

Who is online

Users browsing this forum: acmeconsulting and 57 guests