Page 1 of 1 1
Topic Options
#139276 - 2005-05-06 04:49 PM Question about how to kick off a hidden script.
thepip3r Offline
Hey THIS is FUN
*****

Registered: 2005-03-02
Posts: 350
I'm including a script in our users' logon scripts which grabs a bunch of informaiton and then writes it to a database. Right now I'm using "Call" in our login.kix file to call my script. The problem is that it now makes the logon script take about 20 seconds longer and some users are complaining. Is there anyway that I can kick off the script hidden in the background and run it independently of the logon script so it will finish before the other one does?
Top
#139277 - 2005-05-06 05:04 PM Re: Question about how to kick off a hidden script.
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
You can use "RUN" to start a new thread which can run synchronously.
Top
#139278 - 2005-05-06 05:17 PM Re: Question about how to kick off a hidden script.
thepip3r Offline
Hey THIS is FUN
*****

Registered: 2005-03-02
Posts: 350
Sorry, I guess I was using "RUN":

Code:
If InGroup ("IT.All.Personnel")
RUN "\\DomainController\netlogon\kix\KIX32.exe computerinfo.kix"
EndIf



and the code that this was pulled from the parent logon script and it still waits for the other script to run before it closes...

Top
#139279 - 2005-05-06 05:19 PM Re: Question about how to kick off a hidden script.
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Here is a simple example.

This script will start and call a copy of itself (with a $iTimeToSleep parameter)

The main (parent) script will exit immediately, but the child script will continue to run in the background.

Code:
Break ON

If IsDeclared($iTimeToSleep)
"Child script called"+@CRLF
"Sleeping "+$iTimeToSleep+" seconds"+@CRLF
Sleep Int($iTimeToSleep)
"Child done sleeping, will now exit..."+@CRLF
Exit 0
EndIf

"Parent started, will call child..."+@CRLF
RUN "kix32 "+@SCRIPTNAME+" $$iTimeToSleep=3"
"Parent called chiled - will now exit"+@CRLF
Exit 0



In the real world of course your child script would probably be a completely different script.

Top
#139280 - 2005-05-06 05:22 PM Re: Question about how to kick off a hidden script.
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

and the code that this was pulled from the parent logon script and it still waits for the other script to run before it closes...




Hmmm. Try running it using "%COMSPEC%" with "START".

Top
#139281 - 2005-05-06 05:26 PM Re: Question about how to kick off a hidden script.
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
...like so:
Code:
Break ON

If IsDeclared($iTimeToSleep)
"Child script called"+@CRLF
"Sleeping "+$iTimeToSleep+" seconds"+@CRLF
Sleep Int($iTimeToSleep)
"Child done sleeping, will now exit..."+@CRLF
Exit 0
EndIf

"Parent started, will call child..."+@CRLF
RUN %COMSPEC%+" /C START /MIN kix32 "+@SCRIPTNAME+" $$iTimeToSleep=3"
"Parent called child - will now exit"+@CRLF
Exit 0


Top
#139282 - 2005-05-06 07:11 PM Re: Question about how to kick off a hidden script.
thepip3r Offline
Hey THIS is FUN
*****

Registered: 2005-03-02
Posts: 350
This is what worked, thanx again Richard:

Code:
RUN "%COMSPEC% /C START /MIN \\DomainController\NetLogon\kix\KIX32.exe computerinfo.kix"


Top
Page 1 of 1 1


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

Who's Online
1 registered (Allen) and 363 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.057 seconds in which 0.024 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