Home > Batch Scripting, Enteo, Scripting > Enteo: The 10 minute rule on batch files.

Enteo: The 10 minute rule on batch files.

Heres a tricky problem with Enteo, When executing a batch file enteo only gives a batch file 10 minutes to complete before moving on.

Generally speaking this is no problem as how many batch files do you run take over 10 minutes?

This problem came to light for us when enteo began causing our ESX servers to purple screen of death during the pe stage of the build, which resulted in us moving our virtual servers to a stable ESX while we rebuilt. The problem was that the ESX was so slow with all the added servers that our scripted citrix updates were taking over 10 minutes, the script continued, rebooted the server during the updates and low and behold a very sick citrix server.

The trick to get around this, and i recommend this for any batch file you run in enteo, is to create a looping if statement in the enteo script to check for a registry key. Once you have this key created run your updates then delete the key as the last line in your batch file. This will cause enteo to loop even after the 10 minutes leaving your critical updates to install without fear of being.

heres the idea for the enteo script:

execute %systemdrive%\longbatchfile.bat /?
:check
if exist regkey goto sleep
del %systemdrive%\longbatchfile
Exitproc
:sleep
sleep 60
goto check

And in the batchfile create the reg key, do your work then delete it:

reg add hklm\software\enteo /v checkkey
update1
update2
update3
update4
update5
reg delete hklm\software\enteo /v checkkey

what will happen is simple, even if the script times out, the script will carry on sleeping until the key is deleted, no matter how long it takes.

After the jump is an example of my code so you can see what we did to get around this šŸ™‚

Enteo EScript:

Copy(‘.\Extern$\*.*’,’%windir%\Temp\Hotfix\’)/TW
Execute(‘%windir%\temp\hotfix\hotfix_install.bat’)/?
: Check
If RegValueExists(‘HKEY_LOCAL_MACHINE\SOFTWARE\Enteo’,’rebootstatus’)
goto Sleep
Delete(‘%windir%\temp\hotfix\*.*’)
RemoveDir(‘%windir%\temp\hotfix’)/S/TW
Execute(‘%WINSYSDIR%\shutdown.exe /r /t 30′)
ExitProc(Done)
: Sleep
Sleep(’60’)
goto Check

Batch file:

Rem Adding check registry key
Reg add “HKEY_LOCAL_MACHINE\SOFTWARE\Enteo” /v rebootstatus /t REG_SZ /d “0” /f
msiexec /p %windir%\temp\hotfix\PSE450W2K3R02.msp /qn /norestart
msiexec /p %windir%\temp\hotfix\PSE450R02W2K3002.msp /qn /norestart
msiexec /p %windir%\temp\hotfix\PSE450R02W2K3004.msp /qn /norestart
msiexec /p %windir%\temp\hotfix\PSE450R02W2K3007.msp /qn /norestart
msiexec /p %windir%\temp\hotfix\PSE450R02W2K3008.msp /qn /norestart
msiexec /p %windir%\temp\hotfix\PSE450R02W2K3010.msp /qn /norestart
msiexec /p %windir%\temp\hotfix\PSE450R02W2K3014.msp /qn /norestart
msiexec /p %windir%\temp\hotfix\PSE450R02W2K3036.msp /qn /norestart
msiexec /p %windir%\temp\hotfix\PSE450R02W2K3037.msp /qn /norestart
Rem Clearing check registry key
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Enteo /v rebootstatus /f

as with the above, the batch file controlling when the reg key is created and deleted determines when the script is allowed to end, regardless of enteo’s 10 minute rule.

Categories: Batch Scripting, Enteo, Scripting Tags: ,
  1. ajusubair
    February 17, 2009 at 9:57 am

    sir

    i want to run a bat file every 10 minute

  2. Andrew Morgan
    February 21, 2009 at 11:59 am

    Slightly off topic.

    to execute a batch file every 10 minutes use sleep.exe, you can get it here:http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en

    place your batch file in c:\ with sleep.exe then do something like this:

    :start
    start c:\batchfile.bat
    c:\sleep.exe 600
    goto start

    save the above as file.bat and run it.

  3. September 23, 2009 at 10:35 am

    Configuration Table -> Installation Settings -> “Max. Waiting Period [sec] When Timed Out” Here you can define how many seconds enteo will be waiting for the batch file to finish.

    • Andrew Morgan
      September 23, 2009 at 1:55 pm

      Hi Stefan,

      thank you kindly for your update, that option looks useful.

      That being said, I think I would prefer to loop the job over and over until it has finished rather than entering a higher timeout time and hoping it finishes in the new timeframe.

      Thank you kindly for contributing!

      Andrew

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: