Page 1 of 2 12>
Topic Options
#140746 - 2005-06-01 07:16 PM BrightStor 11.1 TapeCopy
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I am looking to throw together a quick GUI front-end for the BrightStor 11.1 TapeCopy command. Thing is that CA promises to have a GUI version in the next release so I don't want to invest too much time and effort. Has anyone put together anything like this?

The command has a few parms that I would prefer to grab from pick lists and/or folder names. An example CL is as follows:
TapeCopy -s SRV2_D -d LTO -t M-SRV2-SAT-05/28/05 -c TM-SRV2-SAT-05/28/05 -m MLY_TAPE -g

-s = source group name
-d = destination group name
-t = source tape name
-c = destination tape name
-m = assigned media pool
-g = merge detail

I turned on the local catalog DB, so the tape names are in the individual folder names beneath \Program Files\CA\BrightStor ARCserve Backup\CATALOG.DB as tapename.RID which makes getting "-t" easy. Since I only want to copy the monthly tapes, I just need to pull every foldername that starts with "M" and strip off the extension.

Also, since part of the source groupname "-s" is in the tapename, I can rip and manufacture it. The destination tapename "-c" is simply the source name with a T prefix and the destination groupname "-d" and "-m" assigned media pool and "-g" never changes.

I just need a KiXstart (sic) to get my form going, not being much of a KF coder and what with all the new ways to generate picklists. Anyone care to advise?

TIA


Edited by Les (2005-06-01 07:20 PM)
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140747 - 2005-06-01 08:08 PM Re: BrightStor 11.1 TapeCopy
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Cool idea. Are you looking for a "wizard" style thing (it asks you the questions in stages. multi-part forms) or are you looking for a "dialog" style thing (where all the lists are presented on one form) ?
Top
#140748 - 2005-06-01 08:53 PM Re: BrightStor 11.1 TapeCopy
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Not supposed to "look" a gift horse in the mouth, but am looking for a two-part form. Part 2 woul be spawned from the 1st and set filter criteria and present the results in a list.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140749 - 2005-06-01 08:59 PM Re: BrightStor 11.1 TapeCopy
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Eh.. WTF.. you guys were too slow to respond so I started without you. Basically, I grabbed my Computer Rename form and did some R&D (reuse and disguise) and got a skeleton together that kinda looks like this. It is not very well disguised and has no working code yet, but at least I have a bit of a form.

Weird thing with the 2nd (filter) form. If you mouse over titles, they disappear.
Code:
; Script to copy tapes from SAN to LTO
; Requires Kixtart 4.x, Kixforms 2.3.0.38
; by Les Ligetfalvy
break on
dim $label,$frame1,$frame2,$label2,$cmd1,$cmd2,$cmd3,$cmd4,$cmd5,$
Global $form,$Text4,$Text5,$Text6,$form2,$list1,$list2,$label1,$OptionButton1,$OptionButton2,$OptionButton3,$CheckBox1,$label7
$ = setoption('explicit','on')

$Form = CreateObject('Kixtart.Form')
$Form.Caption = 'GUI TapeCopy - beta 1'
$Form.Width = 420
$Form.Height = 500
$Form.center

$label = $Form.Label('Note that only monthly backups will show in the list.'
+ @CRLF + 'Copied tapes will not list by their new name right away.',10,10,400,40)

$Frame1 = $Form.Frame('Select Tape',10,55,240,337)
$Frame2 = $Form.Frame('Action Steps',260,55,145,337)

$label1 = $Form.Label('Monthly Tapes',40,75,120,25)
$list1 = $Form.Listbox(,20,100,220,281)


$label2 = $Form.Label('1: Select Tape'
+ @CRLF + @CRLF + '2: Copy'
+ @CRLF + @CRLF + '3: Repeat or Exit',270,75,160,110)

$cmd3 = $Form.CommandButton('&Copy',280,270)
$cmd3.onclick = 'onbutton3click() $$list1.setfocus'

$cmd4 = $Form.CommandButton('&Group/Date',280,310)
$cmd4.onclick = 'onbutton4click() $$list1.setfocus'

$cmd5 = $Form.CommandButton('E&xit',280,350)
$cmd5.onclick = 'onbutton5click() $$list1.setfocus'

$list2 = $Form.Listbox(,9,400,395,60)

$Form.Show
$list1.setfocus

While $Form.Visible
$=Execute($Form.DoEvents())
Loop

FUNCTION onbutton3click ;Copy
; requires the TapeCopy command
dim $target,$NameSuffix,$NewNamePrefix,$newname,$netdom,$newnamesw,$UserDsw,$UserOsw,$rebootsw,$shellcmd,$selection
select
case $list1.text = -1
$list2.additem(@time + ' - NO TAPE SELECTED, NOTHING TO COPY!',0)
exit 1
case 1
$list2.additem(@time + ' - DOH!',0)
exit 1
endselect
endfunction

FUNCTION onbutton4click ;Select Group and Date
dim $label3,$savebtn,$label4,$label5,$label6,$,$Frame3,$Frame4
$Form2 = CreateObject('Kixtart.Form')
$Form2.Caption = 'BrightStor Tape Groups'
$Form2.Width = 400
$Form2.Height = 300
$Form2.center

$Frame3 = $Form2.Frame('Date Range',10,28,182,190)
$Frame4 = $Form2.Frame('Filter Options',202,28,182,190)


$label3 = $Form2.Label('Enter a date in the format 01-28-05',10,10,390,30)
$savebtn = $Form2.CommandButton('Save and Return',150,230)
$savebtn.onclick = 'onbutton6click()'

$label4 = $Form2.Label("Date:",30,62,48,15)
$label4.alignment = 1
$Text4 = $Form2.Textbox(Split(@date,'/')[1]+'-'+Split(@date,'/')[2]+'-'+Right(Split(@date,'/')[0],2),80,60,90,20)

$label5 = $Form2.Label("Group:",30,92,48,15)
$label5.alignment = 1
$Text5 = $Form2.Textbox('*',80,90,90,20)

$OptionButton1 = $Form2.OptionButton("Before Date",230,60,150,20)
$OptionButton2 = $Form2.OptionButton("After Date",230,90,150,20)
$OptionButton3 = $Form2.OptionButton("Any Date",230,120,150,20)
$OptionButton1.checked = 1


$CheckBox1 = $Form2.Controls.CheckBox("All Groups",230,150,150,20)

$Form2.Show

While $Form2.Visible
$=Execute($Form2.DoEvents())
Loop
endfunction

FUNCTION onbutton5click ;Exit
quit 1
endfunction

FUNCTION onbutton6click ;Exit
;do stuff
endfunction

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140750 - 2005-06-02 12:53 AM Re: BrightStor 11.1 TapeCopy
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
So since it looks great, you don't need any KiXstart i guess ?
Top
#140751 - 2005-06-02 01:38 AM Re: BrightStor 11.1 TapeCopy
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Still would like to know waddup widda disappearing titles.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140752 - 2005-06-02 05:49 AM Re: BrightStor 11.1 TapeCopy
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Still no cure for the titles but I have beta 2.
Code:

; Script to copy tapes from SAN to LTO
; Requires Kixtart 4.x, Kixforms 2.3.0.38
; by Les Ligetfalvy
break on
dim $label,$frame1,$frame2,$frame3,$label2,$cmd1,$cmd2,$cmd3,$cmd4,$cmd5,$
Global $form,$Text4,$Text5,$Text6,$form2,$list1,$list2,$list3,$label1,$OptionButton1,$OptionButton2,$CheckBox1,$label7
$ = setoption('explicit','on')

$Form = CreateObject('Kixtart.Form')
$Form.Caption = 'GUI TapeCopy - beta 2'
$Form.Width = 420
$Form.Height = 500
$Form.center

$label = $Form.Label('Note that only M or TM tapes will show in the lists. Only one tape copy/merge job'
+ @CRLF + 'is allowed at one time. Merge job will follow shortly after the copy job completes.'
+ @CRLF + 'Newly copied LTO tapes will not appear in the list without another Filter Load.',10,10,400,40)

$Frame1 = $Form.Frame('Select SAN Tape',10,55,240,160)
$Frame2 = $Form.Frame('Action Steps',260,55,145,337)
$Frame3 = $Form.Frame('Existing LTO Tapes',10,220,240,172)

$list1 = $Form.Listbox(,20,73,220,130)
$list2 = $Form.Listbox(,20,238,220,142)


$label2 = $Form.Label('1: Load Filter'
+ @CRLF + @CRLF + '2: Select SAN Tape'
+ @CRLF + @CRLF + '3: Copy Tape'
+ @CRLF + @CRLF + '4: Repeat or Exit',270,75,160,110)

$cmd1 = $Form.CommandButton('&Load Filter',280,270)
$cmd1.onclick = 'onbutton1click() $$list1.setfocus'

$cmd2 = $Form.CommandButton('&Copy',280,310)
$cmd2.onclick = 'onbutton2click() $$list1.setfocus'

$cmd5 = $Form.CommandButton('E&xit',280,350)
$cmd5.onclick = 'onbutton5click() $$list1.setfocus'

$list3 = $Form.Listbox(,9,400,395,60)

$Form.Show
$list1.setfocus

While $Form.Visible
$=Execute($Form.DoEvents())
Loop

FUNCTION onbutton1click ;Select Group and Date
dim $label3,$savebtn,$label4,$label5,$label6,$,$Frame4,$Frame5
$Form2 = CreateObject('Kixtart.Form')
$Form2.Caption = 'BrightStor Filter Settings'
$Form2.Width = 400
$Form2.Height = 300
$Form2.center

$Frame4 = $Form2.Frame('Date Range',10,28,182,190)
$Frame5 = $Form2.Frame('Filter Options',202,28,182,190)


$label3 = $Form2.Label('Enter a date in the format 01/28/05',10,10,390,30)
$savebtn = $Form2.CommandButton('Save and Return',150,230)
$savebtn.onclick = 'onbutton6click()'

$label4 = $Form2.Label("Date:",30,62,48,15)
$label4.alignment = 1
$Text4 = $Form2.Textbox(Split(@date,'/')[1]+'/'+Split(@date,'/')[2]+'/'+Right(Split(@date,'/')[0],2),80,60,90,20)

$label5 = $Form2.Label("Group:",30,92,48,15)
$label5.alignment = 1
$Text5 = $Form2.Textbox('SRV1_D',80,90,90,20)

$OptionButton1 = $Form2.OptionButton("After Date",230,60,150,20)
$OptionButton2 = $Form2.OptionButton("Before Date",230,90,150,20)
$OptionButton1.checked = 1


$CheckBox1 = $Form2.Controls.CheckBox("All Groups",230,150,150,20)

$Form2.Show

While $Form2.Visible
$=Execute($Form2.DoEvents())
Loop
endfunction

FUNCTION onbutton5click ;Exit
quit 1
endfunction

FUNCTION onbutton2click ;Copy
;Sample TapeCopy CMD
; TapeCopy -s SRV2_D -d LTO -t M-SRV2-SAT-05/28/05 -c TM-SRV2-SAT-05/28/05 -m MLY_TAPE -g
dim $S,$D,$T,$C,$M,$G,$TapeCopyCMD
select
case $list1.text = -1
$list3.additem(@time + ' - NO TAPE SELECTED, NOTHING TO COPY!',0)
exit 1
case Left($list1.text,1) = 'M'
$S = ' -s '+Split($List1.text,'-')[1]+'_D'
$D = ' -d LTO'
$T = ' -t '+$list1.text
$C = ' -c T'+$list1.text
$M = ' -m MLY_TAPE'
$G = ' -g'
$TapeCopyCMD = 'C:\Program Files\CA\BrightStor ARCserve Backup\TapeCopy.exe'+$S+$D+$T+$C+$M+$G
$list3.additem(@time + ' - Tape '+$list1.text+' copy to T'+$list1.text,0)
exit 1
case Left($list1.text,1) = 'T'
$list3.additem(@time + ' - LTO TAPE SELECTED, CANNOT COPY TO SELF!',0)
exit 1
case 1
$list3.additem(@time + ' - DOH!',0)
exit 1
endselect
endfunction

FUNCTION onbutton6click ;Exit
dim $Folder,$Date,$Group,$FolderArray[6],$SGroup
$Date = $text4.text
$Group = $text5.text
$form2.mousepointer = 11
$list1.clear
$list2.clear
$list3.clear
for each $Folder in dirplus("C:\Program Files\CA\BrightStor ARCserve Backup\CATALOG.DB","/ad")
$FolderArray = Split(Split(Split($Folder,'CATALOG.DB\')[1],'.')[0],'-')
$Folder = Join($FolderArray,'-',4)+'/'+$FolderArray[4]+'/'+$FolderArray[5]
If $FolderArray[0] = 'M' or $FolderArray[0] = 'TM'
$SGroup = $FolderArray[1]+'_D'
select
case $CheckBox1.checked
select
case $optionButton1.checked
If Right($Folder,8) <= $Text4.text
If $FolderArray[0] = 'M'
$list1.additem($Folder)
Else
$list2.additem($Folder)
EndIf
EndIf
case $optionButton2.checked
If Right($Folder,8) >= $Text4.text
If $FolderArray[0] = 'M'
$list1.additem($Folder)
Else
$list2.additem($Folder)
EndIf
EndIf
endselect
case not $CheckBox1.checked
if $Group = $SGroup
select
case $optionButton1.checked
If Right($Folder,8) <= $Text4.text
If $FolderArray[0] = 'M'
$list1.additem($Folder)
Else
$list2.additem($Folder)
EndIf
EndIf
case $optionButton2.checked
If Right($Folder,8) >= $Text4.text
If $FolderArray[0] = 'M'
$list1.additem($Folder)
Else
$list2.additem($Folder)
EndIf
EndIf
endselect
endif
endselect
EndIf
next
$list3.additem(@time + ' - ' + 'Logging started')
$list3.additem('Date filter = '+IIF($optionButton1.checked,'After','Before')+' '+$Text4.text,0)
$list3.additem('Group filter = '+IIF($CheckBox1.checked,'All',$Group),0)
$form2.mousepointer = 1
$form2.hide

endfunction


Function DirPlus($path,optional $Options, optional $f, optional $sfflag)
;Author Bryce Lindsay bryce@isorg.net
If not vartype($f) DIM $f EndIf
If not vartype($sfflag) DIM $sfflag EndIf

DIM $file, $i, $temp, $item, $ex1, $mask,$mask1,$maskArray,$maskarray1,
$ex2, $code, $CodeWeight, $targetWeight, $weight, $masktrue
DIM $tarray[0]

$ex1 = SetOption(Explicit,on)
$ex2 = SetOption(NoVarsInStrings,on)
$codeWeight = 0

If not Exist($path) Exit(2) EndIf
If not vartype($f)
$f = CreateObject("Scripting.FileSystemObject").getfolder($path)
EndIf
If @ERROR
$temp = SetOption(Explicit,$ex1)
$temp = SetOption(NoVarsInStrings,$ex2)
Exit(@ERROR)
EndIf

For Each $temp In Split($options,"/")
$temp=Trim($temp)
Select
Case left($temp,1) = "s"
If not vartype($sfflag)
If Val(right($temp,-1)) = 0
$sfflag = -1
Else
$sfflag = Val(right($temp,-1))
EndIf
EndIf
Case Left($temp,1) = "a"
Select
Case Right($temp,-1)="d"
$codeWeight = $codeWeight + 1
$temp = "if $file.type = 'File Folder' "
Case Right($temp,-1)="-d"
$codeWeight = $codeWeight + 1
$temp = "if $file.type <> 'File Folder' "
Case Right($temp,-1)="s"
$codeWeight = $codeWeight + 1
$temp = "if $file.attributes & 4 "
Case Right($temp,-1)="-s"
$codeWeight = $codeWeight + 1
$temp = "if ($file.attributes & 4)=0 "
Case Right($temp,-1)="h"
$codeWeight = $codeWeight + 1
$temp = "if $file.attributes & 2 "
Case Right($temp,-1)="-h"
$codeWeight = $codeWeight + 1
$temp = "if ($file.attributes & 2)=0 "
Case Right($temp,-1)="r"
$codeWeight = $codeWeight + 1
$temp = "if $file.attributes & 1 "
Case Right($temp,-1)="-r"
$codeWeight = $codeWeight + 1
$temp = "if ($file.attributes & 1)=0 "
Case Right($temp,-1)="a"
$codeWeight = $codeWeight + 1
$temp = "if $file.attributes & 32 "
Case Right($temp,-1)="-a"
$codeWeight = $codeWeight + 1
$temp = "if ($file.attributes & 32)=0 "
EndSelect
$code = $temp + "$weight=$weight+1 endif" +@CRLF + $code

Case Left($temp,1) = "m"
$maskarray = Split(Right($temp,-2),"|")
$codeweight = $codeweight + 1
$code = "$masktrue=0 for Each $mask in $maskarray if instr($file.name,$mask) $masktrue=1 " +
"EndIf Next If $masktrue $weight=$weight+1 endif" + @CRLF +$code
Case Left($temp,1) = "f"
$maskarray1 = Split(Right($temp,-2)," ")
$codeweight = $codeweight + 1
$code = "$masktrue=0 for Each $mask1 in $maskarray1 if substr($file.name,Instrrev($file.name,'.')+1)" +
"=$mask1 $masktrue=1 EndIf Next If $masktrue $weight=$weight+1 endif" + @CRLF +$code

EndSelect
Next
$code = "$weight = 0 $targetWeight = " + $codeweight + @CRLF + $code
$code = $code + "if $weight = $targetweight Exit(1) endif"

For Each $file In $f.subfolders
If Execute($code)
$tarray[$i] = $file
$i = $i + 1
ReDIM preserve $tarray[$i]
EndIf
If $sfflag
$temp = dirplus($file,$options,$file,$sfflag-1)
For Each $item In $temp
$tarray[$i] = $item
$i = $i + 1
ReDIM preserve $tarray[$i]
Next
EndIf
Next
For Each $file In $f.files
If Execute($code)
$tarray[$i] = $file
$i = $i + 1

ReDIM preserve $tarray[$i]
EndIf
Next

If $i
ReDIM preserve $tarray[$i-1]
$i=0
Else
$tarray = 0
EndIf

$dirplus = $tarray
$temp = SetOption(Explicit,$ex1)
$temp = SetOption(NoVarsInStrings,$ex2)
Exit(@ERROR)
EndFunction


Requires the following or similar folders to test:
C:\Program Files\CA\BrightStor ARCserve Backup\CATALOG.DB>dir /b
M-NOTES-TUE-05-31-05.42C1
M-SRV1-FRI-05-27-05.42C1
M-SRV2-FRI-05-27-05.42C2
TM-NOTES-TUE-05-31-05.42C1
TM-SRV1-FRI-05-27-05.42C1
TM-SRV2-FRI-05-27-05.42C2
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140753 - 2005-06-02 06:24 AM Re: BrightStor 11.1 TapeCopy
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Heres a tweaked version of the top part.

Code:

; Script to copy tapes from SAN to LTO
; Requires Kixtart 4.x, Kixforms 2.3.0.38
; by Les Ligetfalvy
break on
dim $label,$frame1,$frame2,$frame3,$label2,$cmd1,$cmd2,$cmd3,$cmd4,$cmd5,$
Global $form,$Text4,$Text5,$Text6,$form2,$list1,$list2,$list3,$label1,$OptionButton1,$OptionButton2,$CheckBox1,$label7
$ = setoption('explicit','on')

$Form = CreateObject('Kixtart.Form')
$Form.Caption = 'GUI TapeCopy - beta 2'
$Form.Width = 420
$Form.Height = 500
$Form.center

$label = $Form.Label('Note that only M or TM tapes will show in the lists. Only one tape copy/merge job'
+ @CRLF + 'is allowed at one time. Merge job will follow shortly after the copy job completes.'
+ @CRLF + 'Newly copied LTO tapes will not appear in the list without another Filter Load.',10,10,400,40)

$Frame1 = $Form.GroupBox('Select SAN Tape',10,55,240,160)
$Frame2 = $Form.GroupBox('Action Steps',260,55,140,337)
$Frame3 = $Form.GroupBox('Existing LTO Tapes',10,220,240,172)

$list1 = $Frame1.Listbox(,10,20,220,130)
$list2 = $Frame3.Listbox(,10,20,220,142)

$label2 = $Frame2.Label('1: Load Filter'
+ @CRLF + @CRLF + '2: Select SAN Tape'
+ @CRLF + @CRLF + '3: Copy Tape'
+ @CRLF + @CRLF + '4: Repeat or Exit',10,20,100,110)

$cmd1 = $Frame2.Button('&Load Filter',10,140,120,30)
$cmd1.onclick = 'onbutton1click() $$list1.setfocus'

$cmd2 = $Frame2.Button('&Copy',10,180,120,30)
$cmd2.onclick = 'onbutton2click() $$list1.setfocus'

$cmd5 = $Frame2.Button('E&xit',10,220,120,30)
$cmd5.onclick = 'onbutton5click() $$list1.setfocus'

$list3 = $Form.Listbox(,9,400,395,60)

$Form.Show
$list1.setfocus

While $Form.Visible
$=Execute($Form.DoEvents())
Loop

Exit 0


Top
#140754 - 2005-06-02 05:30 PM Re: BrightStor 11.1 TapeCopy
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Dang... my R&D skills are not helping to convert $Form2. If I replace $Form2.Frame with $Form2.GroupBox, none of my label, textbox, optionbutton, or checkbox objects are visible. Can someone please help me out with this "new school" way?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140755 - 2005-06-02 05:40 PM Re: BrightStor 11.1 TapeCopy
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
The groupbox is created like this:

$GroupBox = $Form.GroupBox()

Then the controls that appear inside the groupbox, are created as "children" of the groupbox, like this:

$Button = $GroupBox.Button()

The bounds of the button (Left,Top,Width,Height) are then specified in client co-ordinates (relative to the parent GroupBox), for example to position the button in the top left corner of the GroupBox ...

$Button.Location = 0,0

-Shawn

Top
#140756 - 2005-06-02 08:48 PM Re: BrightStor 11.1 TapeCopy
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Thanks Shawn, I did good. Form is now new school enough to do a daddy proud.

Another Q.

Can I set $List2 ListBox so that I can scroll up and down but not select? Don't want to grey out the whole list, just don't want it to highlight an item if clicked on.

Also, I need to verify that for example, if $List1.Text = 'M-NOTES-TUE-05-31-05' and if $List2 has TM-NOTES-TUE-05-31-05 that I log to $List3, a warning and maybe bring the $list2 item into view.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140757 - 2005-06-03 03:32 AM Re: BrightStor 11.1 TapeCopy
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
K, well... Shawn came through for me on MSN again. Thanks!

Beta 3 has all I asked for and more.
Code:

; Script to copy tapes from SAN to LTO
; by Les Ligetfalvy
BREAK ON
DIM $label,$frame1,$frame2,$frame3,$label2,$cmd1,$cmd2,$cmd5,$
GLOBAL $form,$Text4,$Text5,$form2,$list1,$list2,$list3,$label1,$OptionButton1,$OptionButton2,$CheckBox1
$ = SetOption('explicit','on')

$Form = CreateObject('Kixtart.Form')
$Form.Caption = 'GUI TapeCopy - beta 3'
$Form.Width = 420
$Form.Height = 500
$Form.Center

$label = $Form.Label('Note that only M or TM tapes will show in the lists. Only one tape copy/merge job'
+ @CRLF + 'is allowed at one time. Merge job will follow shortly after the copy job completes.'
+ @CRLF + 'Newly merged LTO tapes will not appear in the list without another Filter Load.',10,10,400,40)

$Frame1 = $Form.GroupBox('Select SAN Tape',10,55,240,160)
$Frame2 = $Form.GroupBox('Action Steps',260,55,140,337)
$Frame3 = $Form.GroupBox('Existing LTO Tapes',10,220,240,172)

$list1 = $Frame1.Listbox(,10,20,220,130)
$list2 = $Frame3.Listbox(,10,20,220,142)
$list1.OnClick = 'List1OnClick()'
$list2.OnClick = 'List2OnClick()'


$label2 = $Frame2.Label('1: Load Filter'
+ @CRLF + @CRLF + '2: Select SAN Tape'
+ @CRLF + @CRLF + '3: Copy Tape'
+ @CRLF + @CRLF + '4: Repeat or Exit',10,20,100,110)

$cmd1 = $Frame2.Button('&Load Filter',10,140,120,30)
$cmd1.onclick = 'onbutton1click() $$list1.setfocus'

$cmd2 = $Frame2.Button('&Copy',10,180,120,30)
$cmd2.onclick = 'onbutton2click() $$list1.setfocus'

$cmd5 = $Frame2.Button('E&xit',10,220,120,30)
$cmd5.onclick = 'onbutton5click() $$list1.setfocus'

$list3 = $Form.Listbox(,9,400,395,60)
$list3.OnClick = 'List3OnClick()'

$Form.Show
$list1.setfocus

WHILE $Form.Visible
$=Execute($Form.DoEvents())
LOOP

EXIT 0
;----------------
;Start of KF UDFs
;----------------
FUNCTION List1OnClick()
DIM $
FOR $ = 0 to $list2.listcount - 1
$list2.listindex = $
IF 'T'+$list1.text = $list2.text
$list3.additem('WARNING, '+$list2.text+' ALREADY EXISTS!',0)
$list3.listindex = 0
EXIT 1
ELSE
$list2.listindex = -1
$list3.listindex = -1
ENDIF
NEXT
ENDFUNCTION

FUNCTION List2OnClick()
$list2.listindex = -1
ENDFUNCTION

FUNCTION List3OnClick()
$list3.listindex = -1
ENDFUNCTION

FUNCTION onbutton1click ;SELECT Group and Date
DIM $label3,$savebtn,$label4,$label5,$label6,$,$Frame4,$Frame5
$Form2 = CreateObject('Kixtart.Form')
$Form2.Caption = 'BrightStor Filter Settings'
$Form2.Width = 400
$Form2.Height = 300
$Form2.Center

$Frame4 = $Form2.GroupBox('Date Range',10,28,182,190)
$Frame5 = $Form2.GroupBox('Filter Options',202,28,182,190)


$label3 = $Form2.Label('Enter a date in the format 01/28/05',10,10,390,30)
$savebtn = $Form2.CommandButton('Load and Return',150,230)
$savebtn.onclick = 'onbutton6click()'

$label4 = $Frame4.Label("Date:",10,28,48,15)
$label4.alignment = 1
$Text4 = $Frame4.Textbox(Split(@date,'/')[1]+'/'+Split(@date,'/')[2]+'/'+Right(Split(@date,'/')[0],2),60,25,90,20)

$label5 = $Frame4.Label("Group:",10,154,48,15)
$label5.alignment = 1
$Text5 = $Frame4.Textbox('SRV1_D',60,151,90,20)

$OptionButton1 = $Frame5.OptionButton("After Date",30,25,150,20)
$OptionButton2 = $Frame5.OptionButton("Before Date",30,50,150,20)
$OptionButton1.checked = 1


$CheckBox1 = $Frame5.Controls.CheckBox("All Groups",30,150,150,20)

$Form2.Show

While $Form2.Visible
$=Execute($Form2.DoEvents())
Loop
ENDFUNCTION

FUNCTION onbutton2click ;Copy
;Sample TapeCopy CMD
; TapeCopy -s SRV2_D -d LTO -t M-SRV2-SAT-05/28/05 -c TM-SRV2-SAT-05/28/05 -m MLY_TAPE -g
DIM $S,$D,$T,$C,$M,$G,$TapeCopyCMD
SELECT
CASE $list1.text = -1
$list3.additem(@time + ' - NO TAPE SELECTED, NOTHING TO COPY!',0)
EXIT 1
CASE Left($list1.text,1) = 'M'
$S = ' -s '+Split($List1.text,'-')[1]+'_D'
$D = ' -d LTO'
$T = ' -t '+$list1.text
$C = ' -c T'+$list1.text
$M = ' -m MLY_TAPE'
$G = ' -g'
$TapeCopyCMD = 'C:\Program Files\CA\BrightStor ARCserve Backup\TapeCopy.exe'+$S+$D+$T+$C+$M+$G
$list3.additem(@time + ' - Tape '+$list1.text+' copy to T'+$list1.text,0)
$list3.listindex = 0
$form.mousepointer = 11
WHILE NOT EXIST('C:\Program Files\CA\BrightStor ARCserve Backup\CATALOG.DB\T'+Join(Split($list1.text,'/'),'-')+'.*')
SLEEP 1
LOOP
$form.mousepointer = 1
$list3.additem(@time + ' - DONE!',0)
$list3.listindex = 0
EXIT 1
CASE 1
$list3.additem(@time + ' - DOH!',0)
EXIT 1
ENDSELECT
ENDFUNCTION

FUNCTION onbutton5click ;Exit
QUIT 1
ENDFUNCTION

FUNCTION onbutton6click ;Load Filter
DIM $Folder,$Date,$Group,$FolderArray[6],$SGroup
$Date = $text4.text
$Group = $text5.text
$form2.mousepointer = 11
$list1.clear
$list2.clear
FOR each $Folder in dirplus("C:\Program Files\CA\BrightStor ARCserve Backup\CATALOG.DB","/ad")
$FolderArray = Split(Split(Split($Folder,'CATALOG.DB\')[1],'.')[0],'-')
$Folder = Join($FolderArray,'-',4)+'/'+$FolderArray[4]+'/'+$FolderArray[5]
IF $FolderArray[0] = 'M' or $FolderArray[0] = 'TM'
$SGroup = $FolderArray[1]+'_D'
SELECT
CASE $CheckBox1.checked
SELECT
CASE $optionButton1.checked
IF Right($Folder,8) <= $Text4.text
IF $FolderArray[0] = 'M'
$list1.additem($Folder)
Else
$list2.additem($Folder)
ENDIF
ENDIF
CASE $optionButton2.checked
IF Right($Folder,8) >= $Text4.text
IF $FolderArray[0] = 'M'
$list1.additem($Folder)
Else
$list2.additem($Folder)
ENDIF
ENDIF
ENDSELECT
CASE not $CheckBox1.checked
IF $Group = $SGroup
SELECT
CASE $optionButton1.checked
IF Right($Folder,8) <= $Text4.text
IF $FolderArray[0] = 'M'
$list1.additem($Folder)
Else
$list2.additem($Folder)
ENDIF
ENDIF
CASE $optionButton2.checked
IF Right($Folder,8) >= $Text4.text
IF $FolderArray[0] = 'M'
$list1.additem($Folder)
Else
$list2.additem($Folder)
ENDIF
ENDIF
ENDSELECT
ENDIF
ENDSELECT
ENDIF
NEXT
$list3.listindex = -1
$list3.additem(@time + ' - ' + 'Logging started',0)
$list3.additem('Date filter = '+IIF($optionButton1.checked,'After','Before')+' '+$Text4.text,0)
$list3.additem('Group filter = '+IIF($CheckBox1.checked,'All',$Group),0)
$form2.mousepointer = 1
$form2.hide

ENDFUNCTION

;----------------
; End of KF UDFs
;----------------
FUNCTION DirPlus($path,optional $Options, optional $f, optional $sfflag)
;Author Bryce Lindsay bryce@isorg.net
IF not vartype($f) DIM $f ENDIF
IF not vartype($sfflag) DIM $sfflag ENDIF

DIM $file, $i, $temp, $item, $ex1, $mask,$mask1,$maskArray,$maskarray1,
$ex2, $code, $CodeWeight, $targetWeight, $weight, $masktrue
DIM $tarray[0]

$ex1 = SetOption(Explicit,on)
$ex2 = SetOption(NoVarsInStrings,on)
$codeWeight = 0

IF not Exist($path) Exit(2) ENDIF
IF not vartype($f)
$f = CreateObject("Scripting.FileSystemObject").getfolder($path)
ENDIF
IF @ERROR
$temp = SetOption(Explicit,$ex1)
$temp = SetOption(NoVarsInStrings,$ex2)
Exit(@ERROR)
ENDIF

FOR Each $temp In Split($options,"/")
$temp=Trim($temp)
SELECT
CASE left($temp,1) = "s"
IF not vartype($sfflag)
IF Val(right($temp,-1)) = 0
$sfflag = -1
Else
$sfflag = Val(right($temp,-1))
ENDIF
ENDIF
CASE Left($temp,1) = "a"
SELECT
CASE Right($temp,-1)="d"
$codeWeight = $codeWeight + 1
$temp = "IF $file.type = 'File Folder' "
CASE Right($temp,-1)="-d"
$codeWeight = $codeWeight + 1
$temp = "IF $file.type <> 'File Folder' "
CASE Right($temp,-1)="s"
$codeWeight = $codeWeight + 1
$temp = "IF $file.attributes & 4 "
CASE Right($temp,-1)="-s"
$codeWeight = $codeWeight + 1
$temp = "IF ($file.attributes & 4)=0 "
CASE Right($temp,-1)="h"
$codeWeight = $codeWeight + 1
$temp = "IF $file.attributes & 2 "
CASE Right($temp,-1)="-h"
$codeWeight = $codeWeight + 1
$temp = "IF ($file.attributes & 2)=0 "
CASE Right($temp,-1)="r"
$codeWeight = $codeWeight + 1
$temp = "IF $file.attributes & 1 "
CASE Right($temp,-1)="-r"
$codeWeight = $codeWeight + 1
$temp = "IF ($file.attributes & 1)=0 "
CASE Right($temp,-1)="a"
$codeWeight = $codeWeight + 1
$temp = "IF $file.attributes & 32 "
CASE Right($temp,-1)="-a"
$codeWeight = $codeWeight + 1
$temp = "IF ($file.attributes & 32)=0 "
ENDSELECT
$code = $temp + "$weight=$weight+1 ENDIF" +@CRLF + $code

CASE Left($temp,1) = "m"
$maskarray = Split(Right($temp,-2),"|")
$codeweight = $codeweight + 1
$code = "$masktrue=0 FOR Each $mask in $maskarray IF instr($file.name,$mask) $masktrue=1 " +
"ENDIF NEXT IF $masktrue $weight=$weight+1 ENDIF" + @CRLF +$code
CASE Left($temp,1) = "f"
$maskarray1 = Split(Right($temp,-2)," ")
$codeweight = $codeweight + 1
$code = "$masktrue=0 FOR Each $mask1 in $maskarray1 IF substr($file.name,Instrrev($file.name,'.')+1)" +
"=$mask1 $masktrue=1 ENDIF NEXT IF $masktrue $weight=$weight+1 ENDIF" + @CRLF +$code

ENDSELECT
NEXT
$code = "$weight = 0 $targetWeight = " + $codeweight + @CRLF + $code
$code = $code + "IF $weight = $targetweight Exit(1) ENDIF"

FOR Each $file In $f.subfolders
IF Execute($code)
$tarray[$i] = $file
$i = $i + 1
ReDIM preserve $tarray[$i]
ENDIF
IF $sfflag
$temp = dirplus($file,$options,$file,$sfflag-1)
FOR Each $item In $temp
$tarray[$i] = $item
$i = $i + 1
ReDIM preserve $tarray[$i]
NEXT
ENDIF
NEXT
FOR Each $file In $f.files
IF Execute($code)
$tarray[$i] = $file
$i = $i + 1

ReDIM preserve $tarray[$i]
ENDIF
NEXT

IF $i
ReDIM preserve $tarray[$i-1]
$i=0
Else
$tarray = 0
ENDIF

$dirplus = $tarray
$temp = SetOption(Explicit,$ex1)
$temp = SetOption(NoVarsInStrings,$ex2)
Exit(@ERROR)
ENDFUNCTION

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140758 - 2005-10-27 12:17 AM Re: BrightStor 11.1 TapeCopy
CharlyD Offline
Lurker

Registered: 2005-10-26
Posts: 2
Is is also possible to make this script do DLT tape copy process D2D2T...or D2T
so my for backup DISK2TAPE, with a kix script (scheduled) to be move to tape daily or weekly and after backup 2 tape FILES ON DISK ARE(CAN BE)DELETED.

my GROUPS are (1) DISKPOOL medianame "mm/dd/yy hh:mm pm"
(2) TAPEPOOL medainame "mm/dd/yy hh:mm pm"

my MEDIAPOOLS are (1) *DISKPOOL*
(2) DAY
(3) MONTH
(4) YEAR
and media names DAY,WEEK,MONTH,.....

for the tapecopy command (same as above, ontop)

hope some can do something for me 2
thanks

Top
#140759 - 2005-10-27 02:24 AM Re: BrightStor 11.1 TapeCopy
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Hi CharlyD and welcome to the board.

Sorry to hit you on your first post, but... please don't HiJack topics, please post your own topic and if needed include a link to this post asking for assistance.

When we see a new post on this someone should be able to help you with what you're asking.

Thanks.

Top
#140760 - 2005-10-27 02:41 AM Re: BrightStor 11.1 TapeCopy
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I suppose you could cut out all the GUI stuff and schedule it if so inclined. There is no need to actually delete the FSA (disk) copy of the tape. The retention time will take care of it.

Since posting this, I found out that 11.1 has a problem with the local catalogue db, wherby it prunes it after 30 days. I opened a ticket with CA and 11.5 is purported to fix it. My CD should arrive any day now. I hear that 11.5 has a GUI out for tape copy. I will give it a look/see and if it does not live up to expectation, might post my latest version of the kixform app.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140761 - 2005-10-27 09:26 AM Re: BrightStor 11.1 TapeCopy
CharlyD Offline
Lurker

Registered: 2005-10-26
Posts: 2
ah you have ordered 11.5, to expensive still for me..... i tried to cut and pasted your script but got errors in line162 and so on. the Prunes tine you can adjust in i thought the serveradmin => database. do you have a new version of your script, is it a problem to put it online or...?

hope you can help me...

NTDOC: ok i will do next time ok)

Top
#140762 - 2006-02-28 12:33 AM Re: BrightStor 11.1 TapeCopy
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I am in the unfortunate position of my backup methodology being declared as noncompliant for SOX. I will outline briefly what and how I do things and hope that someone can either corroborate or dispute my assertions that I am compliant.

We do GFS backups to the SAN without verification since there is no potential of media problems (bad tape). The SAN is tested by nature of actual frequent restores and monthly tape copies. All requested restores normally are done from the SAN with the LTO tape copies as extra assurance for long term archiving.

At the beginning of every month, I run this scripted TapeCopy of every monthly tape as per the following example:
tapecopy -s NOTES_D -d LTO -t M-NOTES-TUE-05/31/05 -c TM-NOTES-TUE-05/31/05 -m MLY_TAPE -g

With the -g switch, after the copy has successfully completed, the physical LTO tape is then read and merged into the catalog DB. All this is then logged to a tpcopyxxxx.log file, a sample of which I have enclosed. I contend that the TapeCopy tests both the SAN *virtual* tape's integrity, and also the physical LTO tape's integrity. The physical LTO tape is further verified because the merge operation reads from the physical tape. In my opinion, the entire copy and merge operation is more of a test of the LTO tape media than any single test restore.

The SOx auditor does not accept this and insists that I must test each and every tape by doing test restores and that I must then retain the test results for two years.

The problem I have with that is two fold. First, my scripted TapeCopy is asynchronous (disconnects from the actual submitted job) so it does not know when the copy and subsequent merge operation completes so that I could automate a sequenced test restore. The system will not queue up multiple requests, so to play it safe, I copy one tape per day. I rely on the tpcopyxxxx.log for verification. The second problem then is that if I did test restores, the resultant logs would be buried in the one large (32 meg) monolithic BrightStor.log file. It would be a tedious task to extract the specific job details to satisfy SOx reporting.

I am being told that I must maintain the logs for two full years! I suspect the tpcopyxxxx.log files would never be pruned automatically but the BrightStor.log I doubt would retain two years of details and even if it did, finding and extracting the specific request would be very tedious.
Code:
11:42:26 ************************************************************
*----------Computer Associates Tape Copy Utility,----------*
*Copyright (c) 2004 Computer Associates International, Inc.*
*-------------------All rights reserved.-------------------*
************************************************************

COMMAND LINE: tapecopy -s NOTES_D -d LTO -t M-NOTES-TUE-05/31/05 -c TM-NOTES-TUE-05/31/05 -m MLY_TAPE -g
Tsi connection established as [TAPECOPY-f08]
Tapes are in the device groups: src- NOTES_D , trg- LTO
Connecting to tapes...
Connecting to source tape name [M-NOTES-TUE-05/31/05] rid [42c1] seq [1] s/n[1200000].
Connecting to target tape [] rid [0] seq [0] s/n [ARS223L1]
Making the destination tape a non-mux tape.
Positioning source tape..
Positioning target tape..
Starting session on source tape..
Starting session on target tape..
Session 1 started on source
Session 1 started on target
Session 1 copied from source tape to
Session 1 on the target tape
Kb copied : 2920192
Total time : 1.2 minutes
Throughput : 2539.297 mb/min
Session 2 started on target
Session 2 copied from source tape to
Session 2 on the target tape
Kb copied : 119606336
Total time : 42.1 minutes
Throughput : 2839.161 mb/min
Session 3 started on target
Session 3 copied from source tape to
Session 3 on the target tape
Kb copied : 453440
Total time : 0.2 minutes
Throughput : 2650.404 mb/min
Session 4 started on target
Session 4 copied from source tape to
Session 4 on the target tape
Kb copied : 3761984
Total time : 1.4 minutes
Throughput : 2713.393 mb/min
Session 5 started on target
Session 5 copied from source tape to
Session 5 on the target tape
Kb copied : 39543744
Total time : 16.3 minutes
Throughput : 2426.848 mb/min
Session 6 started on target
Session 6 copied from source tape to
Session 6 on the target tape
Kb copied : 246784
Total time : 0.1 minutes
Throughput : 2493.607 mb/min
Session 7 started on target
Session 7 copied from source tape to
Session 7 on the target tape
Kb copied : 31937344
Total time : 12.9 minutes
Throughput : 2471.669 mb/min
Session 8 started on target
Session 8 copied from source tape to
Session 8 on the target tape
Kb copied : 1408
Total time : 0.0 minutes
Throughput : 491.163 mb/min
Merging tape: [TM-NOTES-TUE-05/31/05] rid [42c1] seq [1] s/n[ARS223L1] into database...
Scheduled for 9/20/2005-13:02
Adding tape name [TM-NOTES-TUE-05/31/05] rid [42c1] seq [1] s/n[ARS223L1] into media pool: [MLY_TAPE]
Tape Copy ended successfully

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140763 - 2006-02-28 12:45 AM Re: BrightStor 11.1 TapeCopy
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
Dumb question... what does SOX stand for?

I don't know anything about your backup software... but man I feel your pain

Top
#140764 - 2006-02-28 01:18 AM Re: BrightStor 11.1 TapeCopy
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
SOX = Sarbanes-Oxley - a pair of US Senators with too much time on their hands.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140765 - 2006-02-28 01:25 AM Re: BrightStor 11.1 TapeCopy
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
SOX = yet another stupid methodology that everyone wants to say they're compliant with, but will forget about in 5 years time. Kinda like "the ISO 9000" de jour.
Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.054 seconds in which 0.02 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org