Page 1 of 1 1
Topic Options
#127193 - 2004-09-29 07:23 PM Setting priorities for order of scripts to run
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
I am working on designing a script that would determine if a certain section should run (On/Off)

1 = On
0 = Off.

If the section of the script is "On" setting a priority to for the order in which it should run.

Scenario:

Script1 Priority = 125
Script2 Priority = 200
Script3 Priority = 50

In this scenario since script2's priority is 200 it would run first, then script1 and 3. The highest number would determine which order it should run.

For some reason I cannot wrap my brain around this and come up with the logic. I would need this logic for calling approx. 50 different scripts that are in use (On) and approx 45 that are used intermittently (Off).

This is going to be kixtart executable(s) that will reside on our company laptops to keep all of the personal oracle databases in sync. I am considering using an INI file to set the On/Off and Priority which would reside on the network so it could be easily modified and universally effect every laptop.

Any help would be greatly appreciated.


_________________________
I haven't failed. I just found another way that did not work.

Top
#127194 - 2004-09-29 07:46 PM Re: Setting priorities for order of scripts to run
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Do you know the order in which you would like to execute the scripts? Can you list them in that order without setting a different property for the priority?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#127195 - 2004-09-29 08:05 PM Re: Setting priorities for order of scripts to run
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I was thinking of using a script to build an IN file like:
Code:
[c:\data\scripts\script1.kix]
run=1
[c:\data\scripts\script2.kix]
run=0
[c:\data\scripts\script3.kix]
run=1
[c:\data\scripts\script4.kix]
run=1
[c:\data\scripts\script5.kix]
run=1



The section names would be fully qualified script names in the order you wanted to execute them. The value under the section would signify if the script should execute or not.

This code would then be the parent that uses the INI file to execute those scripts you desire in the specified order.
Code:
$File = "c:\data\scripts\junk.ini"
if exist($File)
$ScriptArray = split(ReadProfileString($File,"",""),chr(10))
for each $script in $ScriptArray
if val(ReadProfileString($File,$script,"run"))
? "Execute: " + $script
else
? "DO NOT execute: " + $script
endif
next
else
? "File not found: " + $File
endif

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#127196 - 2004-09-29 09:01 PM Re: Setting priorities for order of scripts to run
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
Yes I do know the order in which the standard scripts should run but the main reason for prioritizing and turning scripts on and off will be mainly for disaster recovery for a database crash so we can redirect these users to the standby database and determine if any duplicate data has been replicated up to our network database from the users personal oracle. Quite often these scripts need to be written on the fly for recovery.
_________________________
I haven't failed. I just found another way that did not work.

Top
#127197 - 2004-09-29 10:20 PM Re: Setting priorities for order of scripts to run
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Then, I am not sure why this idea will not work for you. All you have to do is re-write the INI to execute whatever scripts you want in whatever order you want.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#127198 - 2004-09-29 10:38 PM Re: Setting priorities for order of scripts to run
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
Yes this will work for me. I think I was just making the solution more complicated than it should have been.

And once again thank you very much for the help on another script this message board always comes up with the answer for me when my brain starts to hurt.
_________________________
I haven't failed. I just found another way that did not work.

Top
#127199 - 2004-09-30 10:11 AM Re: Setting priorities for order of scripts to run
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
INI files are OK if you are going to manually keep them up to date.

If you are going to manage them programatically then they are a pain, as the sections will not be added in any order.

To preserve the order (and guard against errors if the file is manually updated), give the section a name that can be easily sorted.

Your ini file could look like this:
Code:
[SyncStart]
Path=c:\scripts\syncstartscripts
[Recover]
Path=c:\scripts\recoverscripts
[SyncStart_001]
File=somescript.kix
NoRun=1
[SyncStart_123]
File=script123.kix
Params=$sFoo=bar
NoRun=0
[SyncStart_045]
File=script45.kix
NoRun=0
[Recover_200]
File=recsscipt.kix
[Recover_101]
File=recother.kix
NoRun=1



In which case your code would look something like this:
Code:
$sRunLevel=".\runlevel.ini"

For Each $sScript in GetScripts("SyncStart",$sRunLevel)
"Executing '"+$sScript+"'"+@CRLF
Next

Function GetScripts($sType,Optional $sFile)
Dim $sPath, $sOptions, $sSection
If Not $sFile $sFile=".\runlevel.ini" EndIf

$sPath=ReadProfileString($sFile,$sType,"Path")
If $sPath $sPath=$sPath+"\" EndIf

For Each $sSection In qs(Split(ReadProfileString($sFile,"",""),Chr(10)))
If InStr($sSection,$sType+"_")=1
If Not Int(ReadProfileString($sFile,$sSection,"NoRun"))
Redim Preserve $GetScripts[UBound($GetScripts)+1]
$GetScripts[UBound($GetScripts)]=Trim(
$sPath
+ReadProfileString($sFile,$sSection,"File")
+" "
+ReadProfileString($sFile,$sSection,"Params")
)
EndIf
EndIf
Next
EndFunction

; Use whichever sort UDF you prefer - I've borrowed this one

; BrianTX's Quicksort
function qs($a)
DIM $b[32],$c[32],$d,$e,$f,$g,$h,$i,$j,$k,$l
$b[0]=0
$c[0]=UBOUND($a)
$d=0
While $d >=0
$e=$b[$d]
$f=$c[$d]
While $e < $f
$h=$e+($f-$e)/2
$k=$a[$e]
$A[$e]=$A[$h]
$A[$h]=$k
$i=$e+1
$j=$f
$l=0
Do
While ($i<$j) AND $A[$e] > $A[$i]
$i=$i+1
Loop
While ($j>=$i) AND $A[$j] > $A[$e]
$j=$j-1
Loop
IF $i>=$j
$l=1
ELSE
$k=$A[$i]
$A[$i]=$A[$j]
$A[$j]=$k
$j=$j-1
$i=$i+1
ENDIF
Until $l=1
$k=$a[$e]
$a[$e]=$a[$j]
$a[$j]=$k
$g=$j
If $g-$e <= $f - $g
If $g+1 < $f
$b[$d]=$g+1
$c[$d]=$f
$d=$d+1
Endif
$f=$g-1
Else
If $g-1 > $e
$b[$d]=$e
$c[$d]=$g-1
$d=$d+1
Endif
$e=$g+1
Endif
Loop
$d=$d-1
Loop
$qs=$a
Endfunction



I've used qs() to order the array as I had it handy, but you can use whatever you like.

Output from the sample looks like this:
Code:
Executing 'c:\scripts\syncstartscripts\script45.kix'
Executing 'c:\scripts\syncstartscripts\script123.kix $sFoo=bar'


Top
#127200 - 2004-09-30 03:07 PM Re: Setting priorities for order of scripts to run
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Interesting addition.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#127201 - 2004-09-30 04:28 PM Re: Setting priorities for order of scripts to run
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
You people amaze me I have been beating myself up on this logic for 2 weeks and you can pull it together in minutes. I hope I will make it to your level someday.
_________________________
I haven't failed. I just found another way that did not work.

Top
#127202 - 2004-09-30 07:37 PM Re: Setting priorities for order of scripts to run
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
Here is what I have come up with to add to the script. This will keep all files up to date on the laptop. If one is added or deleted from the network share then it will be added or deleted from the laptop as well. This way if scripts need to be written on the fly we can add it to the netshare folder and drop in a new INI file.


;This script will keep kixtart scripts and ini files up to date
;and call the control script.

[code]
Break on
SetConsole ("hide")
Global $scriptspath,$netpath,$workdir,$oralogon
$workdir = "c:\mtglaptop"
$scriptspath = "c:\mtglaptop\scripts"
$netpath = "\\server1\share\kixscripts"
$oralogon = "c:\oracle\ora81\bin\sqlplus user/password" + Chr(64) + "database"
Del $workdir +"files.dat"
Shell "%comspec% /e:1024 /c dir " + $netpath + " /b > " + $workdir + "\files.dat"
Shell "%comspec% /e:1024 /c dir " + $scriptspath + " /b >> " + $workdir + "\files.dat"
Open (1,"$workdir\files.dat",2)

Do
$file = ReadLine (1)
If @ERROR <> 0
$end=1
GoTo end
EndIf
$compare = CompareFileTimes ($netpath+ "\" + $file,$scriptspath+"\" + $file)
Select
Case $compare = 1
Copy $netpath +"\" + $file $scriptspath
?"copying " + $netpath "\" + $file
Case $compare = -2
Del $scriptspath + "\" $file
?"Deleting " + $scriptspath + "\" + $file
Case $compare = -3
Copy $netpath +"\" + $file $scriptspath
?"copying " + $netpath "\" + $file
Case $compare = 0
?$file + " Did not need to be updated"
EndSelect
:end
Until $end=1
Close (1)
Call $workdir +"\control.kix"


"Contol.KIX"

Break on
run "c:\$workdir\pbar.exe"
$File = "c:\mtglaptop\settings.ini"
If Exist($File)
$ScriptArray = Split(ReadProfileString($File,"",""),Chr(10))
For Each $script in $ScriptArray
If Val(ReadProfileString($File,$script,"run"))
? "Execute: " + $script
Else
? "DO NOT execute: " + $script
EndIf
Next
Else
? "File not found: " + $File
EndIf

INI File

[c:\mtglaptop\scripts\script1.kix]
run=1
[c:\mtglaptop\scripts\script2.kix]
run=0
[c:\mtglaptop\scripts\script3.kix]
run=1
[c:\mtglaptop\scripts\script4.kix]
run=1
[c:\mtglaptop\scripts\script5.kix]
run=1


PBAR.EXE
;This progress bar only simulates activity. This is to show the user that something is happening on the laptop and show tech support at what point the script may have failed. I use this for another script that I have written to build a personal oracle database or recover the database from a crashed laptop.

;****************************
;******Progress Bar**********
;****************************

SetConsole ("alwaysontop")
Break on

$time=@TIME
$database=0
$logdir="c:\db_fixes\kix"
If Exist ("$logdir\recover.log")
$log="$logdir\userfile.log"
$message="Copying Users personal files."
Else
$log="$logdir\ftp.log"
$message="Retrieving Maintenance Datafiles."
EndIf
$oranet="x:\oracle\oradata\mtglo"
$oralocal="c:\oracle\oradata\mtglo"
$file="\control01.dbf"
:progressbar
CLS
If Exist ("$logdir\fail.log")
GoTo failnet
EndIf
If Exist ("$log")
Select
Case $log="$logdir\fannie.log"
GoTo recovermsg
Case $log="$logdir\dispatch.log"
$log="$logdir\fannie.log"
$message="Copying Fannie Mae Files."
Case $log="$logdir\copy.log"
$log="$logdir\dispatch.log"
$message="Copying Freddie Mac Files."
Case $log="$logdir\notes.log"
$log="$logdir\copy.log"
$message=""
Case $log="$logdir\userfile.log"
$log="$logdir\notes.log"
$message = "Copy Lotus Notes Files."
Case $log="$logdir\personal.log"
GoTo message
Case $log="$logdir\import_end.log"
$log="$logdir\end_time_log"
$message="Updating Table Structure."
GoTo progressbar
Case $log="$logdir\personal.log"
GoTo message
Case $log="$logdir\userdetail.log"
$log="$logdir\personal.log"
$message="Personalizing Database."
Case $log="$logdir\lspwtables.log"
$log="$logdir\userdetail.log"
$message="Importing lspwtables Data."
GoTo progressbar
Case $log="$logdir\import6.log"
$log="$logdir\lspwtables.log"
$message="Importing Maintenance Data 6"
GoTo progressbar
Case $log="$logdir\import5.log"
$log="$logdir\import6.log"
$message="Importing Maintenance Data 5."
GoTo progressbar
Case $log="$logdir\import4.log"
$log="$logdir\import5.log"
$message="Importing Maintenance Data 4."
GoTo progressbar
Case $log="$logdir\import3.log"
$log="$logdir\import4.log"
$message="Importing Maintenance Data 3."
GoTo progressbar
Case $log="$logdir\import2.log"
$log="$logdir\import3.log"
$message="Importing Maintenance Data 2."
GoTo progressbar
Case $log="$logdir\import_start.log"
$log="$logdir\import2.log"
$message="Importing Maintenance Data 1."
GoTo progressbar
Case $log="$logdir\fileupdate.log"
$log="$logdir\import_start.log"
$message="Creating Oracle Database."
$database=1
GoTo progressbar
Case $log="$logdir\ftp.log"
$log="$logdir\fileupdate.log"
$message="Updating Orcle Configuration Files."


EndSelect
EndIf
:copyprog
If $log = "$logdir\copy.log"
Select
Case Exist ("$logdir\users01.log")
If Exist ("$logdir\copyfail.log")
Color n/n
Open (1,"$logdir\copyfail.log",2)
$copyfail=ReadLine (1)
Beep Beep Beep
Color r+/n
At (2,25) "ALERT ERRORS WHILE COPYING DATABASE"
While $copyfail>""
Color y+/n
?$copyfail
$copyfail=ReadLine (1)
Loop
Color n/n
Close (1)
Color g/n
;Gosub delete
At (22,28)"Press any key to Exit"
Get $end
Exit
EndIf
Case Exist ("$logdir\tools01.log")
$file = "\users01.dbf"
Case Exist ("$logdir\temp01.log")
$file = "\tools01.dbf"
Case Exist ("$logdir\system01.log")
$file = "\temp01.dbf"
Case Exist ("$logdir\redo03.log")
$file = "\system01.dbf"
Case Exist ("$logdir\redo02.log")
$file = "redo03.log"
Case Exist ("$logdir\redo01.log")
$file = "\redo02.log"
Case Exist ("$logdir\rbs01.log")
$file = "\redo01.log"
Case Exist ("$logdir\lsdata02.log")
$file = "\rbs01.dbf"
Case Exist ("$logdir\lsdata01.log")
$file = "\lsdata02.dbf"
Case Exist ("$logdir\control03.log")
$file = "\lsdata01.dbf"
Case Exist ("$logdir\control02.log")
$file = "\control03.ctl"
Case Exist ("$logdir\control01.log")
$file = "\control02.ctl"
EndSelect
Color g+/n
At (17,10) "Copying $oranet$file"
EndIf


Color y/n
Box(1,15,3,58,"double")
Color c+/n
If Exist ("$logdir\recover.log")
At (2,17) "Company Recovery Utility"
Else
At (2,17) "Company Setup Utility"
EndIf
Color g+/n
At(6,3)"Setup Start Time: " Color y+/n $time
Color w+/n
At(6,50)"Current Time: "
Color c+/n
If $database=1
At (17,12) "Running Oracle Scripts " Color r+/n "DO NOT " Color c+/n "Close out any Windows!"
At(15,20)"$message"
Else
At(15,20)"$message"

EndIf

Color b+/n
Box(10,10,12,65,"double")
$COL = 12
While $COL < 64
Color b+/n
Select
Case $col < 32
Gosub timer
Color r+/n
$sign = Chr(6) ; chr(176) for block bar "/"
Case $col < 48
Gosub timer
Color y+/n
$sign = Chr(7) ; chr(178) for block bar "\"
Case $col < 64
Gosub timer
Color g+/n
$sign = Chr(6) ; chr(177) for block bar "H"
EndSelect
At(11,$COL) $sign
$COL = $COL + 1
$Y = 100 * ($COL - 12) / 52
If ($COL & Rnd() ) = 0 ; simulate activiity
Sleep 1
EndIf

Loop


GoTo progressbar

:message
CLS

Close (9)
At(3,5)"Setup Start Time: " $time
At(3,46)"Setup Completion Time: " @TIME
Color m+/n
At (6,22)"******* SETUP IS COMPLETE *******"
Color b+/n
Gosub delete
At (22,28)"Press any key to Exit"
Get $end
GoTo scriptend

:recovermsg
Color y+/n
?"Recovery Started at $starttime Completed at @TIME"
Color r+/n
?"Press any key to exit" Get $done
Exit

:failnet
CLS
Open (1,"$logdir\fail.log",2)
$error=ReadLine (1)
Close (1)
CLS
At(3,5)"Setup Start Time: " $time
At(3,46)"Setup Stop Error Time: " @TIME
Color r+/n
At (8,10) $error
At (10,10)"******* FAILED TO CONNECT TO SOURCE COMPUTER *******"
Color y+/n
At (12,10)"1. Source computer is offline."
At (13,10)"2. Invalid computer name or IP Address."
Color b+/n
;Gosub delete
At (22,28)"Press any key to Exit"
Get $end
GoTo scriptend

:scriptend

Exit

:timer
Color y+/n
At(6,65)@TIME
Return
:delete

Del "$logdir\*.log"
Del "$logdir\newlo.sql"
Return
[/code]


Question:
How do you keep the format whenever I indent the script it always defaults to left justified?


Edited by Fugazi (2004-09-30 11:11 PM)
_________________________
I haven't failed. I just found another way that did not work.

Top
#127203 - 2004-09-30 09:38 PM Re: Setting priorities for order of scripts to run
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
http://www.kixtart.org/ubbthreads/faq.php?Cat=#html

use

[code]

...formated code goes here....

[/code]

Top
#127204 - 2004-09-30 10:27 PM Re: Setting priorities for order of scripts to run
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
If you keep solving problems, reading other people samples, and writing code; you will see your coding skills increase.

Oh, before anyone else mentions it. Your coding style should avoid the use of "Goto". Other construct exist that allow for the building of more readable and elegant scripts.


Please edit your code posting and place it between the "Instant UBB Code" Code tags to preserve its formatting.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#127205 - 2004-09-30 11:18 PM Re: Setting priorities for order of scripts to run
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
Code:
 Break on

SetConsole ("hide")
Global $scriptspath,$netpath,$workdir,$oralogon
$workdir = "c:\mtglaptop"
$scriptspath = "c:\mtglaptop\scripts"
$netpath = "\\server1\share\kixscripts"
$oralogon = "c:\oracle\ora81\bin\sqlplus user/password" + Chr(64) + "database"
Del $workdir +"files.dat"
Shell "%comspec% /e:1024 /c dir " + $netpath + " /b > " + $workdir + "\files.dat"
Shell "%comspec% /e:1024 /c dir " + $scriptspath + " /b >> " + $workdir + "\files.dat"
Open (1,"$workdir\files.dat",2)

Do
$file = ReadLine (1)
If @ERROR <> 0
$end=1
GoTo end
EndIf
$compare = CompareFileTimes ($netpath+ "\" + $file,$scriptspath+"\" + $file)
Select
Case $compare = 1
Copy $netpath +"\" + $file $scriptspath
?"copying " + $netpath "\" + $file
Case $compare = -2
Del $scriptspath + "\" $file
?"Deleting " + $scriptspath + "\" + $file
Case $compare = -3
Copy $netpath +"\" + $file $scriptspath
?"copying " + $netpath "\" + $file
Case $compare = 0
?$file + " Did not need to be updated"
EndSelect
:end
Until $end=1
Close (1)
Call $workdir +"\control.kix"


"Contol.KIX"

Break on
run "c:\$workdir\pbar.exe"
$File = "c:\mtglaptop\settings.ini"
If Exist($File)
$ScriptArray = Split(ReadProfileString($File,"",""),Chr(10))
For Each $script in $ScriptArray
If Val(ReadProfileString($File,$script,"run"))
? "Execute: " + $script
Else
? "DO NOT execute: " + $script
EndIf
Next
Else
? "File not found: " + $File
EndIf

INI File

[c:\mtglaptop\scripts\script1.kix]
run=1
[c:\mtglaptop\scripts\script2.kix]
run=0
[c:\mtglaptop\scripts\script3.kix]
run=1
[c:\mtglaptop\scripts\script4.kix]
run=1
[c:\mtglaptop\scripts\script5.kix]
run=1


PBAR.EXE
;This progress bar only simulates activity. This is to show the user that something is happening on the laptop and show tech support at what point the script may have failed. I use this for another script that I have written to build a personal oracle database or recover the database from a crashed laptop.

;****************************
;******Progress Bar**********
;****************************

SetConsole ("alwaysontop")
Break on

$time=@TIME
$database=0
$logdir="c:\db_fixes\kix"
If Exist ("$logdir\recover.log")
$log="$logdir\userfile.log"
$message="Copying Users personal files."
Else
$log="$logdir\ftp.log"
$message="Retrieving Maintenance Datafiles."
EndIf
$oranet="x:\oracle\oradata\mtglo"
$oralocal="c:\oracle\oradata\mtglo"
$file="\control01.dbf"
:progressbar
CLS
If Exist ("$logdir\fail.log")
GoTo failnet
EndIf
If Exist ("$log")
Select
Case $log="$logdir\fannie.log"
GoTo recovermsg
Case $log="$logdir\dispatch.log"
$log="$logdir\fannie.log"
$message="Copying Fannie Mae Files."
Case $log="$logdir\copy.log"
$log="$logdir\dispatch.log"
$message="Copying Freddie Mac Files."
Case $log="$logdir\notes.log"
$log="$logdir\copy.log"
$message=""
Case $log="$logdir\userfile.log"
$log="$logdir\notes.log"
$message = "Copy Lotus Notes Files."
Case $log="$logdir\personal.log"
GoTo message
Case $log="$logdir\import_end.log"
$log="$logdir\end_time_log"
$message="Updating Table Structure."
GoTo progressbar
Case $log="$logdir\personal.log"
GoTo message
Case $log="$logdir\userdetail.log"
$log="$logdir\personal.log"
$message="Personalizing Database."
Case $log="$logdir\lspwtables.log"
$log="$logdir\userdetail.log"
$message="Importing lspwtables Data."
GoTo progressbar
Case $log="$logdir\import6.log"
$log="$logdir\lspwtables.log"
$message="Importing Maintenance Data 6"
GoTo progressbar
Case $log="$logdir\import5.log"
$log="$logdir\import6.log"
$message="Importing Maintenance Data 5."
GoTo progressbar
Case $log="$logdir\import4.log"
$log="$logdir\import5.log"
$message="Importing Maintenance Data 4."
GoTo progressbar
Case $log="$logdir\import3.log"
$log="$logdir\import4.log"
$message="Importing Maintenance Data 3."
GoTo progressbar
Case $log="$logdir\import2.log"
$log="$logdir\import3.log"
$message="Importing Maintenance Data 2."
GoTo progressbar
Case $log="$logdir\import_start.log"
$log="$logdir\import2.log"
$message="Importing Maintenance Data 1."
GoTo progressbar
Case $log="$logdir\fileupdate.log"
$log="$logdir\import_start.log"
$message="Creating Oracle Database."
$database=1
GoTo progressbar
Case $log="$logdir\ftp.log"
$log="$logdir\fileupdate.log"
$message="Updating Orcle Configuration Files."


EndSelect
EndIf
:copyprog
If $log = "$logdir\copy.log"
Select
Case Exist ("$logdir\users01.log")
If Exist ("$logdir\copyfail.log")
Color n/n
Open (1,"$logdir\copyfail.log",2)
$copyfail=ReadLine (1)
Beep Beep Beep
Color r+/n
At (2,25) "ALERT ERRORS WHILE COPYING DATABASE"
While $copyfail>""
Color y+/n
?$copyfail
$copyfail=ReadLine (1)
Loop
Color n/n
Close (1)
Color g/n
;Gosub delete
At (22,28)"Press any key to Exit"
Get $end
Exit
EndIf
Case Exist ("$logdir\tools01.log")
$file = "\users01.dbf"
Case Exist ("$logdir\temp01.log")
$file = "\tools01.dbf"
Case Exist ("$logdir\system01.log")
$file = "\temp01.dbf"
Case Exist ("$logdir\redo03.log")
$file = "\system01.dbf"
Case Exist ("$logdir\redo02.log")
$file = "redo03.log"
Case Exist ("$logdir\redo01.log")
$file = "\redo02.log"
Case Exist ("$logdir\rbs01.log")
$file = "\redo01.log"
Case Exist ("$logdir\lsdata02.log")
$file = "\rbs01.dbf"
Case Exist ("$logdir\lsdata01.log")
$file = "\lsdata02.dbf"
Case Exist ("$logdir\control03.log")
$file = "\lsdata01.dbf"
Case Exist ("$logdir\control02.log")
$file = "\control03.ctl"
Case Exist ("$logdir\control01.log")
$file = "\control02.ctl"
EndSelect
Color g+/n
At (17,10) "Copying $oranet$file"
EndIf


Color y/n
Box(1,15,3,58,"double")
Color c+/n
If Exist ("$logdir\recover.log")
At (2,17) "Company Recovery Utility"
Else
At (2,17) "Company Setup Utility"
EndIf
Color g+/n
At(6,3)"Setup Start Time: " Color y+/n $time
Color w+/n
At(6,50)"Current Time: "
Color c+/n
If $database=1
At (17,12) "Running Oracle Scripts " Color r+/n "DO NOT " Color c+/n "Close out any Windows!"
At(15,20)"$message"
Else
At(15,20)"$message"

EndIf

Color b+/n
Box(10,10,12,65,"double")
$COL = 12
While $COL < 64
Color b+/n
Select
Case $col < 32
Gosub timer
Color r+/n
$sign = Chr(6) ; chr(176) for block bar "/"
Case $col < 48
Gosub timer
Color y+/n
$sign = Chr(7) ; chr(178) for block bar "\"
Case $col < 64
Gosub timer
Color g+/n
$sign = Chr(6) ; chr(177) for block bar "H"
EndSelect
At(11,$COL) $sign
$COL = $COL + 1
$Y = 100 * ($COL - 12) / 52
If ($COL & Rnd() ) = 0 ; simulate activiity
Sleep 1
EndIf

Loop


GoTo progressbar

:message
CLS

Close (9)
At(3,5)"Setup Start Time: " $time
At(3,46)"Setup Completion Time: " @TIME
Color m+/n
At (6,22)"******* SETUP IS COMPLETE *******"
Color b+/n
Gosub delete
At (22,28)"Press any key to Exit"
Get $end
GoTo scriptend

:recovermsg
Color y+/n
?"Recovery Started at $starttime Completed at @TIME"
Color r+/n
?"Press any key to exit" Get $done
Exit

:failnet
CLS
Open (1,"$logdir\fail.log",2)
$error=ReadLine (1)
Close (1)
CLS
At(3,5)"Setup Start Time: " $time
At(3,46)"Setup Stop Error Time: " @TIME
Color r+/n
At (8,10) $error
At (10,10)"******* FAILED TO CONNECT TO SOURCE COMPUTER *******"
Color y+/n
At (12,10)"1. Source computer is offline."
At (13,10)"2. Invalid computer name or IP Address."
Color b+/n
;Gosub delete
At (22,28)"Press any key to Exit"
Get $end
GoTo scriptend

:scriptend

Exit

:timer
Color y+/n
At(6,65)@TIME
Return
:delete

Del "$logdir\*.log"
Del "$logdir\newlo.sql"
Return






I have no problem with you ripping my code apart and showing me a more effienct way.


Edited by Fugazi (2004-09-30 11:40 PM)
_________________________
I haven't failed. I just found another way that did not work.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 476 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.066 seconds in which 0.027 seconds were spent on a total of 12 queries. Zlib compression enabled.

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