Set a limit on WPKG run on startup...

259 views
Skip to first unread message

Marco Gaiarin

unread,
Mar 25, 2013, 3:53:31 AM3/25/13
to wpk...@googlegroups.com

I'm a long user of WPKG, until now with WPKG Client, but i'm moving to
Win7 and so i'm switching to WPKG-GP.

We are revising our ''recipe'' adding timeouts, but, as a safeguard
measure, we are considering adding a ''tiemout'' on the WPKG run: AFAIK
by default there's no limit, so apply the hardcoded wpkg.js limit of an
hour for every exec() call.


There's some way to set a global ''timeout'' for WPKG-GP run on
startup? Eg, can i set a config option or a policy so that after some
predefined time, WPKG-GP get killed (and logon appear), or go to
background (logon appear, but wpkg.js continue their work)?


Thanks.

--
dott. Marco Gaiarin GNUPG Key ID: 240A3D66
Associazione ``La Nostra Famiglia'' http://www.sv.lnf.it/
Polo FVG - Via della Bontà, 7 - 33078 - San Vito al Tagliamento (PN)
marco.gaiarin(at)lanostrafamiglia.it t +39-0434-842711 f +39-0434-842797

Dona il 5 PER MILLE a LA NOSTRA FAMIGLIA!
http://www.lanostrafamiglia.it/chi_siamo/5xmille.php
(cf 00307430132, categoria ONLUS oppure RICERCA SANITARIA)

le.d...@laposte.net

unread,
Mar 25, 2013, 10:02:14 AM3/25/13
to wpk...@googlegroups.com, ga...@sv.lnf.it
Maybe this could look like Wpkg-Client which offers a possibility (Ctrl+Q => password) to show the login screen before it has ended. User opens a session while Wpkg's running.

Now the only timeout is the one hour per exec(). If a .xml is buggy, machine can stay blocked for hours, the only way to stop this is to kill processes from another machine using PsExec for example.

Marco Gaiarin

unread,
Mar 25, 2013, 1:29:18 PM3/25/13
to wpk...@googlegroups.com
Mandi! le.d...@laposte.net
In chel di` si favelave...

> Maybe this could look like Wpkg-Client which offers a possibility (Ctrl+Q =>
> password) to show the login screen before it has ended. User opens a session
> while Wpkg's running.

I've tried WPKG Client (that i use on XP), but got killed on shutdown
and i was not able to display nothing on startup on win seven.

You use WPKGClient on startup and got the wait screen displayed?

Marco Gaiarin

unread,
Apr 2, 2013, 10:34:22 AM4/2/13
to wpk...@googlegroups.com

Sorry, but (apart some hint, AFAIK wrong, on WPKGClient) no one reply.

> There's some way to set a global ''timeout'' for WPKG-GP run on
> startup? Eg, can i set a config option or a policy so that after some
> predefined time, WPKG-GP get killed (and logon appear), or go to
> background (logon appear, but wpkg.js continue their work)?

I restate. Thanks.

Michał Sacharewicz

unread,
Apr 2, 2013, 5:03:53 PM4/2/13
to wpk...@googlegroups.com, ga...@sv.lnf.it
Have you tried a global timeout on GPO execution?

Computer/Policies/Administrative templates/System/Scripts/Maximum wait time for Group Policy scripts

Marco Gaiarin

unread,
Apr 3, 2013, 5:19:09 AM4/3/13
to wpk...@googlegroups.com
Mandi! Michał Sacharewicz
In chel di` si favelave...

> Have you tried a global timeout on GPO execution?
> Computer/Policies/Administrative templates/System/Scripts/Maximum wait time for Group Policy scripts

Mmmmhhh... policy description say:

Determines how long the system waits for scripts applied by Group
Policy to run.\n\n\nThis setting limits the total time allowed for all
logon, logoff, startup, and shutdown scripts applied by Group Policy to
finish running. If the scripts have not finished running when the
specified time expires, the system stops script processing and records
an error event.\n\n\nBy default, the system lets the combined set of
scripts run for up to 600 seconds (10 minutes), but you can use this
setting to adjust this interval.\n\n\nTo use this setting, in the
Seconds box, type a number from 1 to 32,000 for the number of seconds
you want the system to wait for the set of scripts to finish. To direct
the system to wait until the scripts have finished, no matter how long
they take, type 0.\n\n\nThis interval is particularly important when
other system tasks must wait while the scripts complete. By default,
each startup script must complete before the next one runs. Also, you
can use the "Run logon scripts synchronously" setting to direct the
system to wait for the logon scripts to complete before loading the
desktop.\n\n\nAn excessively long interval can delay the system and
inconvenience users. However, if the interval is too short,
prerequisite tasks might not be done, and the system can appear to be
ready prematurely.

and 've not touched that value, so seems to me that this limit apply
only to scripts, not to GPO Extensions (as WPKG-GP are).

A googling around lead me to:

http://www.tech-archive.net/Archive/WinXP/microsoft.public.windowsxp.configuration_manage/2007-03/msg00144.html

so seems that the 'one hour for GPO' run is an hardcoded value, and the
MaxGPOScriptWait registry/policy apply to single scripts.


I hope on a reply on this topic by Christoffer...

Michał Sacharewicz

unread,
Apr 3, 2013, 5:43:10 AM4/3/13
to wpk...@googlegroups.com, ga...@sv.lnf.it
At http://wpkg.org/Timeouts you'll find:

The server-side script wpkg.js has a build in default timeout of 3600 seconds = 60 minutes = 1 hour, it specifies the total time all installation processes are allowed to run.

I've checked the current stable release of the wpkg.js file and found it at the following line:

1607:    var exitCode = exec(checkPath, 3600, null);

which corresponds to:

9403:    function exec(cmd, timeout, workdir)

So... replace 3600 with as many seconds as you need and... voila! :)

Marco Gaiarin

unread,
Apr 3, 2013, 10:27:42 AM4/3/13
to Michał Sacharewicz, wpk...@googlegroups.com
Mandi! Michał Sacharewicz
In chel di` si favelave...

[I've not take care that i'vemoved to private email, so, sorry, come
back to list with the solution]


> IMO you can inject some parameters to cscript itself via this
> WpkgCommand, eg. if you do:
> > WpkgCommand = "//T:60 \\my\share\wpkg.js"
> then Wpkg-GP would actually run this:
> > cscript //T:60 \\my\share\wpkg.js /synchronize
> The //T:60 is a cscript parameter that will force cscript to kill
> script after 60 seconds. Check 'cscript /?' for details.

Michał, many thanks! I've never minded of using cscript parameters!


I've done some test and... works, indeed not as expected: i've
bult a test recipe:

<package
id="test-stall"
name="Test: stallo dell'installazione"
revision="1:1"
reboot="false"
priority="50">

<!-- verifico l'esistenza del file di log, alla peggio lo eseguo una volta ;-) -->
<check type="file" condition="exists" path="%TEMP%\wpkg-test-stall.log" />

<install cmd='%COMSPEC% /c ping -t 127.0.0.1 &gt; "%TEMP%\wpkg-test-stall.log"' />

<upgrade include="install" />
<downgrade include="upgrade" />

<remove cmd='%COMSPEC% /c del /f /q "%TEMP%\wpkg-test-stall.log"' />
</package>


And effectively after 10 minutes wpkg.js get killed, but not all the
child process, so effectively my PING command is still running (file
%TEMP%\wpkg-test-stall.log are growing).

Probably it is also a side effect of running it in a '%COMSPEC% /c'
jail...



Anyway, thanks.
Reply all
Reply to author
Forward
0 new messages