Pre/Post run job drive parameter

Use this forum for help with AISBackup
Aquarjen
Posts: 24
Joined: Tue Aug 26, 2008 9:24 pm
Location: Ireland

Pre/Post run job drive parameter

Post by Aquarjen »

Barry,

I have a backup job that uses multiple external destination drives (neat feature, btw).

I need to run a post-job that needs the destination drive letter, but that letter changes depending on the drive attached.

I can't seem to find any reference on how to access and place that info into the parameter field. I would have expected something like "XD" or AISPARM:=Dest.

Is there a way to make AISBackup do what I need?

Regards,
Aquarjen.
Barry
Site Admin
Posts: 1529
Joined: Tue Aug 20, 2002 3:16 pm

Last used destination letter

Post by Barry »

AISBackup is supposed to be able to pass an xml file that contains details of the backup job just ran, however this is not working properly and does not work for multiple external drive backups.

Would you be able to read an xml file in your post run job?

This data may help:

<Destination Path="P:\Backups\WIN7PRO64 (C) on TIGER\">



Here is an example for a backup to a local drive run earlier today:

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1"?>
<AISBackup ID="WIN7PRO64 &#40;C&#41; Drive to Disk_Run001">
  <JobName>WIN7PRO64 &#40;C&#41; Drive to Disk</JobName>
  <Summary>
    <DateTimeOfBackup>
      <Day>27</Day>
      <Month>10</Month>
      <Year>2009</Year>
      <Hour>21</Hour>
      <Minute>34</Minute>
    </DateTimeOfBackup>
    <Job>Backup Session&#58; 5 Started on 27 October 2009 at 21&#58;35&#58;44</Job>
    <FailedToAccessDuringCalculateBackup>0</FailedToAccessDuringCalculateBackup>
    <FailedToBackup>0</FailedToBackup>
    <InUseExcludedByUser>0</InUseExcludedByUser>
    <ValidationFailures>0</ValidationFailures>
    <DeletedPriorToBackup>0</DeletedPriorToBackup>
    <ExclusivelyOpened>0</ExclusivelyOpened>
    <BackedUp>2133</BackedUp>
    <ENDJOB>Backup Finished Okay</ENDJOB>
  </Summary>
  <CreatedBackupFiles>
    <Destination Path="P&#58;\Backups\WIN7PRO64 &#40;C&#41; on TIGER\">
      <VolId ID="&#91;DATA2&#93;">
        <File>DISK_C_214.zip</File>
        <File>DISK_C_215.zip</File>
        <File>DISK_C_216.zip</File>
        <File>DISK_C_217.zip</File>
        <File>DISK_C_218.zip</File>
        <File>DISK_C_219.zip</File>
        <File>DISK_C_220.zip</File>
        <File>DISK_C_221.zip</File>
        <File>DISK_C_222.zip</File>
      </VolId>
    </Destination>
  </CreatedBackupFiles>
</AISBackup>
Barry
Aquarjen
Posts: 24
Joined: Tue Aug 26, 2008 9:24 pm
Location: Ireland

Re: Last used destination letter

Post by Aquarjen »

Barry wrote:Would you be able to read an xml file in your post run job?
I suppose I could but it sort of defeats my goal in simplifying things; a backup is the only lifeline there is and I need clarity or else wind up with files missing from the image.

I've found a couple of ways to filter out the drive letter but that entails installing one or two applications on ALL my PC's or write a program myself. Window's grep (findstr.exe) and most, if not all, regular grep apps don't include an option for extracting a piece of text from a sentence. I know that Cygwin's grep does this to a certain extent but to install Linux on all of my PC's just to extract a single letter?...

I added a third drive to a backup set and before that, with only two drives, I was able to utilize the pre- and post-run lines to start the process with different drive letters before and after the backup job. I had to manually check and sometimes remove stuff winding up unintended on drives that occupied the drive letter of the other drive in the set (I use fixed drive designations and pretty much ran out of drive letters). That sort of did the job but on failure I would wind up with a dud since the pre-run job had already run and was out of sync with the older backup.

Since AISBackup does the automatic drive letter rotation the logical thing would be to pass that letter on to a placeholder of some kind in the pre- and post run job parameter lines. Barry, would you not consider adding this feature in a not too distant future (read: yesterday :D) version?

Regards,
Aquarjen.
Barry
Site Admin
Posts: 1529
Joined: Tue Aug 20, 2002 3:16 pm

Optional parameters to pre and post run jobs

Post by Barry »

okay - while we're at it:

Does anybody else want to list some optional parameters to be passed to the pre and post run jobs?

So far we have we will include:

/d{lastdestinationpath}, e.g. /d"c:\backups\my docs\my documents\"

The quotes will be omitted if the path did not contain spaces. The reason I state last destination path is to cover multiple DVD drives pre-loaded with blank media - the last used would be passed as a parameter.

another possible inclusion could be /j"job name"

Aquarjen: Please e-mail me the post run job so that I can test it with any updates made to AISBackup.

Barry
Aquarjen
Posts: 24
Joined: Tue Aug 26, 2008 9:24 pm
Location: Ireland

Re: Optional parameters to pre and post run jobs

Post by Aquarjen »

Barry wrote:okay - while we're at it:

Does anybody else want to list some optional parameters to be passed to the pre and post run jobs?

So far we have we will include:

/d{lastdestinationpath}, e.g. /d"c:\backups\my docs\my documents"

The quotes will be omitted if the path did not contain spaces. The reason I state last destination path is to cover multiple DVD drives pre-loaded with blank media - the last used would be passed as a parameter.

another possible inclusion could be /j"job name"

Aquarjen: Please e-mail me the post run job so that I can test it with any updates made to AISBackup.

Barry
What I'm doing is quite simple (a batch file) but for it to work I need AISBackup to hand me the driveletter it chose from the external drive list.

The scenario would be like this:

Before/After backup job: Run this program: [d:\somedir\some.bat]
Working directory: [empty in this particular setup]
Parameters: Z: Y: /drive[:]

Some applications do not seem to understand a colon (as my batch files don't), so if AISBackup just delivers the drive letter we can always add the colon in the parameter field, if needed.

In this case I specifically DON'T need the jobname or path returned (I would still need an external product to filter out the driveletter), just the bare driveletter. I dont have to 'be' in the job folder, but I have to 'be' on the drive in question. I can see the usefulness of being able to request the job's path and jobname so by all means add anything you can think of. :cool:

Some suggestions:
/p job's path
/d job's drive
/x job's XML
/n job's name
/l job's logfile
Barry
Site Admin
Posts: 1529
Joined: Tue Aug 20, 2002 3:16 pm

Batch commands (~DOS)

Post by Barry »

(I would still need an external product to filter out the driveletter)
You can do this using DOS, here is some experimental code for you to try:

Call the following command batch (call it test.bat) like:

test.bat /l"c:\aisbackup\database folder\mydocs.log" /p"w:\aisbackup\backup destination path" /n"My documents backup" /x"c:\aisbackup\database folder\mydocs.xml"

Code: Select all

&#58;&#58;
&#58;&#58; Example Command Batch file to unpack AISBackup optional parameters
&#58;&#58;
&#58;&#58; To remove quotes from quoted strings &#40;path names with spaces&#41; remove the
&#58;&#58; comment characaters &#58;&#58; from the appropriate lines below
&#58;&#58;
&#58;&#58;

@echo off
&#58;lloop
set parameter=%1
if &#40;%parameter%&#41;==&#40;&#41; goto lread-arguments
if &#40;%parameter&#58;~0,2%&#41;==&#40;/p&#41; goto lgetpath
if &#40;%parameter&#58;~0,2%&#41;==&#40;/l&#41; set log=%parameter&#58;~2%
if &#40;%parameter&#58;~0,2%&#41;==&#40;/n&#41; set jobname=%parameter&#58;~2%
if &#40;%parameter&#58;~0,2%&#41;==&#40;/x&#41; set xml=%parameter&#58;~2%
goto lcontinue

&#58;lgetpath
set backuppath=%parameter&#58;~2%
for /f "useback tokens=*" %%a in &#40;'%backuppath%'&#41; do set parameter=%%~a
set drive=%parameter&#58;~0,1%

&#58;lcontinue
shift
goto lloop


&#58;lread-arguments

&#58;&#58; Uncomment to remove quotes from parameter

&#58;&#58; for /f "useback tokens=*" %%a in &#40;'%backuppath%'&#41; do set backuppath=%%~a
&#58;&#58; for /f "useback tokens=*" %%a in &#40;'%log%'&#41; do set log=%%~a
&#58;&#58; for /f "useback tokens=*" %%a in &#40;'%xml%'&#41; do set xml=%%~a
&#58;&#58; for /f "useback tokens=*" %%a in &#40;'%jobname%'&#41; do set jobname=%%~a

echo Job name&#58; %jobname%
echo Drive&#58; %drive%
echo Path&#58; %backuppath%
echo Log&#58; %log%
echo XML&#58; %xml%
Barry
Aquarjen
Posts: 24
Joined: Tue Aug 26, 2008 9:24 pm
Location: Ireland

Re: Batch commands (~DOS)

Post by Aquarjen »

Barry wrote:
You can do this using DOS, here is some experimental code for you to try:

Call the following command batch (call it test.bat) like:

test.bat /l"c:\aisbackup\database folder\mydocs.log" /p"w:\aisbackup\backup destination path" /n"My documents backup" /x"c:\aisbackup\database folder\mydocs.xml"
I'm not at all sure that this is going to work.

A. While experimenting I think I've seen instances where the XML file wasn't created yet when the post-run call occurred.

B. If the backup has never run, the XML file will also never be there and the test run procedure won't work.

If you still are going to make this modification I'll rather wait for it than continue experimenting and then having to redo them later.

Aquarjen.
Barry
Site Admin
Posts: 1529
Joined: Tue Aug 20, 2002 3:16 pm

Post by Barry »

While experimenting I think I've seen instances where the XML file wasn't created yet when the post-run call occurred.
I said earlier:
AISBackup is supposed to be able to pass an xml file that contains details of the backup job just ran, however this is not working properly and does not work for multiple external drive backups.


The XML file if found would be from the previous backup session as AISbackup incorrectly made the XML file after the post run job.

This will be fixed in build 361, buid 361 will also contain some additional parameters and an option to start the batch file by way as a prototype - this will extract the drive letter from the database path.

Barry[/quote]
Aquarjen
Posts: 24
Joined: Tue Aug 26, 2008 9:24 pm
Location: Ireland

Post by Aquarjen »

Barry wrote:
While experimenting I think I've seen instances where the XML file wasn't created yet when the post-run call occurred.
I said earlier:
AISBackup is supposed to be able to pass an xml file that contains details of the backup job just ran, however this is not working properly and does not work for multiple external drive backups.


The XML file if found would be from the previous backup session as AISbackup incorrectly made the XML file after the post run job.

This will be fixed in build 361, buid 361 will also contain some additional parameters and an option to start the batch file by way as a prototype - this will extract the drive letter from the database path.

Barry
Okay then, I didn't grasp that form your earlier post. But, while you're fiddling with this control anyway, how about adding a few fields to support external zippers and encrypters? Many modern backup apps support things like these and I for one would welcome being able to do on the fly backups without having to open an encrypted partition each time and/or leaving it open all day long. I would like to be able to choose my own (trusted) applications for either, as would potential clients that don't feel comfortable leaving everything in your (any developer's) hands.

Aquarjen.
Barry
Site Admin
Posts: 1529
Joined: Tue Aug 20, 2002 3:16 pm

Request

Post by Barry »

Okay then, I didn't grasp that form your earlier post. But, while you're fiddling with this control anyway, how about adding a few fields to support external zippers and encrypters
Work is been done on presenting parameters to the post run job. Your request is too vague for me to understand what you want. Or did you want to feed the destination back to AISBackup rather than AISBackup work it out?

Barry
Aquarjen
Posts: 24
Joined: Tue Aug 26, 2008 9:24 pm
Location: Ireland

Re: Request

Post by Aquarjen »

Barry wrote:
Okay then, I didn't grasp that form your earlier post. But, while you're fiddling with this control anyway, how about adding a few fields to support external zippers and encrypters
Work is been done on presenting parameters to the post run job. Your request is too vague for me to understand what you want. Or did you want to feed the destination back to AISBackup rather than AISBackup work it out?

Barry
My request has nothing much to do with the drive parameters but since it has bearing on the same control I thought I'd mention it. Many of the other backup solutions offer encryption and a few other features that, otherwise Swiss Army Knife, AISBackup lacks, like delta's (this is a genuine hint). If the job control had few fields for external compression and encryption applications than one could opt for calling those (AISBackup passing/requesting through them). I'm not sure if the pretty amazing AISBackup speed won't suffer, but other backup solutions I've seen are so slow that that won't be a real problem for the situations I would use this feature for; there would be ample speed left.
Aquarjen
Posts: 24
Joined: Tue Aug 26, 2008 9:24 pm
Location: Ireland

Post by Aquarjen »

Barry wrote:
This will be fixed in build 361, buid 361 will also contain some additional parameters and an option to start the batch file by way as a prototype - this will extract the drive letter from the database path.

Barry
I've installed 361. Some observations:

A. If I run a preview with 360 and also with 361 I get a 'slight' difference of about 15GB worth of files. If I check I see no changes in the names, sizes, dates, attributes...

B. I've had no time yet to test your mod. It looks quite daunting for what I need, although I can see the value of it. But really all I needed was the driveletter AISBackup used as a placeholder in the Parameter field; there's nothing in AISBackup's files I need other than that letter.

Run this program:[batchapplication.bat __________]

Working Directory:[__________________________]

Parameters:[myparms /driveletterusedforjob______]

Since I uninstalled 361 I cannot see if one of your switches in fact already did that.

Aquarjen.
Barry
Site Admin
Posts: 1529
Joined: Tue Aug 20, 2002 3:16 pm

New post job paramaters

Post by Barry »

Using the prototype generated code, which extracts the drive letter you want, you can leave the generated code as is, except remove the pause command, and then access the drive letter using %drive% - there are examples in the code using the echo command.

Simply run the generated code as it is to see the code in action - at least the results should be clearer.

I do not observe differences in the files selected in build 360 and 361: Please give more information about the backup and discrepancies.

If All Debug Mode is on then the reason for file selection is displayed in the log - this may help resolve any problem. Press * until **** All Debug Mode *** is displayed in the AISBackup coption.

What is the source of the backup, e.g. network or local hard drive?

Here is the code if you are only interested in the drive letter:

Code: Select all

@echo off
&#58;lloop
set parameter=%1
if &#40;%parameter%&#41;==&#40;&#41; goto lread-arguments
if &#40;%parameter&#58;~0,2%&#41;==&#40;/p&#41; goto lgetpath
goto lcontinue

&#58;lgetpath
set backuppath=%parameter&#58;~2%
for /f "useback tokens=*" %%a in &#40;'%backuppath%'&#41; do set parameter=%%~a
set drive=%parameter&#58;~0,1%

&#58;lcontinue
shift
goto lloop

&#58;lread-arguments

echo The drive is %drive%

&#58;&#58; Remove the pause when done with testing
pause
Barry
Aquarjen
Posts: 24
Joined: Tue Aug 26, 2008 9:24 pm
Location: Ireland

Re: New post job paramaters

Post by Aquarjen »

Barry wrote:Using the prototype generated code, which extracts the drive letter you want, you can leave the generated code as is, except remove the pause command, and then access the drive letter using %drive% - there are examples in the code using the echo command.
Barry
Can I use that code in my own batch file or does it have to be the file AISBackup generates? Currently I use my own stuff and extract the drive letter via Window's findstr command plus code you provided some time ago. But that relies on the existance of the xml file which AISBackup 360 didn't guarantee. Since 361 corrupts everything I cannot run a sample to see if the xml gets produced; even a single filecopy destroys my existing backup.

There's a typo in the post run dialog: Paramaters should be Parameters.
Barry wrote:I do not observe differences in the files selected in build 360 and 361: Please give more information about the backup and discrepancies.
Barry
Where do I begin? For instance, the Windows folder seems to have been reinstalled as over 4GB of files are selected for backup.

As an example, I am certain I have made no recent changes to the Fonts and Cursors folder but both are selected for a backup of their complete contents. I inspected a few files at random and some seem unchanged and others have discrepancies in their time; some are off by one second, others are/seem equal.

AISBackup stated that 1775 files needed backing up, with a size of -9xxx GB.

When I selected to remove all but one file from the backup it still wanted to backup all 1775 files.

There's someting seriously wrong with 361.

Aquarjen.
Barry
Site Admin
Posts: 1529
Joined: Tue Aug 20, 2002 3:16 pm

Build 361 problems

Post by Barry »

Many people have taken up build 361 and the problem you have noticed has not been reported by anybody else - that's is not to say there is no problem.

It would help if you could make a small backup using build 360 and then install 361 and, run build 361 in 'all debug mode' and e-mail the log file so that the reason why the files are selected for backup ca be ascertained.

The code shows how easy it is to extract the drive letter from the backup destination parameter - you can substitute your own code if you prefer.
Since 361 corrupts everything I cannot run a sample to see if the xml gets produced; even a single filecopy destroys my existing backup.
Please explain how build 361 corrupts everything. Please explain step by step the single file copy is destroying your existing backup so that the problem can be replicated here and repaired. It would help if you could e-mail the <backup>.buz file or use the help/bug report function to send the complete set of job files for this backup.

For testing the batch job updates I cannot see how a new small backup would corrupt any other backup jobs that you have.

It is possible that the backup contents file was not opened from your backup media, this would cause the backup to select all files, for example if another drive with the same name as the external drive was present on the PC then AISBackup may try and load the contents file from the disk without a backup and therefore backup everything. This problem would also have been with build 360.


Barry
Post Reply