#207676 - 2013-09-03 07:50 PM
Logic gut check
|
Tsguy
Getting the hang of it
Registered: 2010-01-18
Posts: 67
Loc: Oregon
|
Hello all,
I realize there are a number of ways to skin a kix script ;), but I was hoping for a general Logic gut check on a project I'm working on.
The script is using "ComputerinGroup" as a Udf - http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=195717
What I'm attempting to do is:
- Determine if the computer running the script is in a domain security group. - Determine if a file exists on the computer. - If the computer is in the domain security group, and the file doesn't exist, run a CMD script and then wait for the file to exist. - The called CMD script will create a file on the computer once it completes that should be the trigger kix is waiting for to continue processing. - If the computer runs the script, change the reboot flag to 1, so that the comp will be rebooted at script's end.
;
CALL '\\Networkserver\Networkshare\ComputerinGroup.udf'
;
$Access2k10 = '\\Networkserver\Networkshare\O2k10-Access.cmd'
$A2k10Check = Exist("c:\scripts\Installed\A2k10.txt")
$MessageHeader = ' Software is being installed to your computer '
$Reboot = 0
;
If ComputerinGroup ("Access2k10") AND $A2k10Check = 0
MessageBox ("$MessageHeader"," Access 2010 is being installed / upgraded... ",0,30)
$Reboot = 1
RUN $Access2k10
DO
Sleep 10
Until $A2k10Check = 1
EndIf
;
If $Reboot = 1
Shutdown ("", "The upgrades performed on your computer require a reboot, that will occur in 20 seconds.", 20, 1, 1)
Else
Exit
This is not the full script as there are a number of other moving parts in it. But this is the general premise that I'm looking to accomplish with this particular section. What I'm unclear on most is if the Do / Until and the file existence checks make sense as they are currently. My first time looping...(that sounds a bit odd i know)
thanks for any advice,
Lan
|
|
Top
|
|
|
|
#207679 - 2013-09-03 10:09 PM
Re: Logic gut check
[Re: Glenn Barnas]
|
Tsguy
Getting the hang of it
Registered: 2010-01-18
Posts: 67
Loc: Oregon
|
Hi Glenn 
Thank you for your input, as the exist checking was also something I was a bit unclear on. Modified code below.
;
CALL '\\Networkserver\Networkshare\ComputerinGroup.udf'
;
$Access2k10 = '\\Networkserver\Networkshare\O2k10-Access.cmd'
$A2k10Check = 'c:\scripts\Installed\A2k10.txt'
$MessageHeader = ' Software is being installed to your computer '
$Reboot = 0
;
If ComputerinGroup ("Access2k10") AND NOT EXIST ($A2k10Check)
MessageBox ("$MessageHeader"," Access 2010 is being installed / upgraded... ",0,30)
$Reboot = 1
RUN $Access2k10
DO
Sleep 10
Until EXIST ($A2k10Check)
EndIf
;
If $Reboot = 1
Shutdown ("", "The upgrades performed on your computer require a reboot, that will occur in 20 seconds.", 20, 1, 1)
Else
Exit
You also have an excellent point about possible forever loop if there's a failure in the called CMD. However, I'm closing my eyes, and ignoring that potential problem for now.
|
|
Top
|
|
|
|
#207681 - 2013-09-03 11:56 PM
Re: Logic gut check
[Re: Glenn Barnas]
|
Tsguy
Getting the hang of it
Registered: 2010-01-18
Posts: 67
Loc: Oregon
|
Again, more great points Glenn.
The flag files; yes, it's an issue, but one we're trying to mitigate a bit in our own way, and at this point there are a number of projects wrapped into the framework. We decided not to pursue the concept unless a clear use design was implemented, documented, followed, and maintained. Reg keys were brought up as an option in the design, but the format we're in won out for other reasons.
I had considered Shelling out the call to CMD when I started on this project (and may still do so). At the time of writing, I liked the idea of the kix script waiting on the flag to appear.
ty again for your insight Glenn,
Lan
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Henriques)
and 2516 anonymous users online.
|
|
|