The support forum

I can't get Post-backup command to work

XeidiDent :

Jan 10, 2018

I'm trying to set up Bvckup 2 to run a command after the backup is done to compress the backed up files, but I can't get it to work.

The command is : "7za a -tzip -mx9 -r <destinationfolder>"%DATE:~-4%.%DATE:~3,2%.%DATE:~7,2%-%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%-file.zip" <sourcefolder>".

I tested it in CMD and as a batch file and it works, but when I tell Bvckup 2 to run the command itself or the batch file neither work.

How should I do this?

Alex Pankratov :

Jan 10, 2018

You need to provide the full path to "7za", e.g. "C:\Program Files\7zip\7za.exe", quoting it as needed.

XeidiDent :

Jan 11, 2018

Alright. I changed the batch file to:

"C:\Program Files\Bvckup 2\7z\7za" a -tzip -mx9 -r "destionationfolder\%DATE:~-4%.%DATE:~3,2%.%DATE:~0,2%-%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%-file.zip" "sourcefolder"

and in Bvckup 2 to:

cmd /c "C:\Program Files\Bvckup 2\compress.bat"

It works now. Thanks.

XeidiDent :

Jan 18, 2018

It doesn't work when Bvckup 2 is running in service mode, only in desktop mode.

Is it intended?

Alex Pankratov :

Jan 18, 2018

There are no differences in how pre/post-commands are handled in service mode. How exactly does it not work? What do you see in the backup log?

XeidiDent :

Jan 18, 2018

In both desktop and service mode it says that the command was completed, although in service mode the "Exit code" is "1" and it doesn't compress the files; in desktop mode the "Exit code" is "0" and it does compress the files. In both modes the Post-backup command is exactly the same to run the same batch file to compress the copied files.


Service mode:

2018.01.18 12:43:36.395 (UTC-3) 2 2         Running external post-backup command ...

2018.01.18 12:43:36.396 (UTC-3) 3 3             Command: cmd /c "E:\Luiz\Programas\Portable\7z\batchFiles\compress.bat"
2018.01.18 12:43:36.396 (UTC-3) 3 4                 Spawn as: process
2018.01.18 12:43:36.396 (UTC-3) 3 4                 Timeout: 1 hour
2018.01.18 12:43:36.396 (UTC-3) 3 4                 Exit code: any
2018.01.18 12:43:36.427 (UTC-3) 3 3             Completed
2018.01.18 12:43:36.427 (UTC-3) 3 4                 Exit code: 1


Desktop mode:

2018.01.18 12:45:03.069 (UTC-3) 2 2         Running external post-backup command ...

2018.01.18 12:45:03.070 (UTC-3) 3 3             Command: cmd /c "E:\Luiz\Programas\Portable\7z\batchFiles\compress.bat"
2018.01.18 12:45:03.070 (UTC-3) 3 4                 Spawn as: process
2018.01.18 12:45:03.070 (UTC-3) 3 4                 Timeout: 1 hour
2018.01.18 12:45:03.070 (UTC-3) 3 4                 Exit code: any
2018.01.18 12:47:15.793 (UTC-3) 3 3             Completed
2018.01.18 12:47:15.793 (UTC-3) 3 4                 Exit code: 0

XeidiDent :

Jan 18, 2018

Notice how in service mode it completes in the same second that it starts and in desktop mode it takes 2 minutes to complete.

Alex Pankratov :

Jan 18, 2018

The "cmd /c ..." spawns the "cmd", so that part works.

The issue is with what you execute in the .bat itself. If you are referencing any mapped drives or network locations, keep in mind that they may simple not exist or be inaccessible under the service account... that sort of thing.

PS. I'd add some logging to your .bat, see how 7za is failing exactly.

XeidiDent :

Jan 18, 2018

It's not a mapped drive or network location, but I did have to give permission to the user account used by the Bvckup 2 service since not even the Administrators group has access to this directory.

Thanks again for your great support and patience. This is one of the reasons that weighted the most on my decision to purchase this software.

New topic

Create
Made by Pipemetrics in Switzerland
Support


Follow
Twitter
Blog / RSS
Miscellanea Press resources
Testimonials
On robocopy
Company
Imprint

Legal Terms
Privacy