Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: smart automatic updates 1


From   Nick Winter <nw53@cornell.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: smart automatic updates 1
Date   Thu, 26 Feb 2004 12:25:25 -0500

I would do something like this:

qui update q
local needado = (r(inst_ado)<r(avbl_ado))
local needexe = (r(inst_exe)<r(avbl_exe))

if `needado' | `needexe' {
   local done 0
   while !`done' {
      if `needado' & `needexe' {
         capture update all
      }
      else if `needado' {
         capture update ado
      }
      else if `needexe' {
         capture update exe
      }

      if !_rc {
         local done 1
      }
      else {
         display "Retrying . . ."
      }
   }
   if `needexe' {
      update swap
   }



At 04:55 PM 2/26/2004 +0100, you wrote:
Hi Listers

Quetion

I would like to write a small program to be run each midnight or weekly
on a network-server with stata.
I would like the program to update stata
if the update is timed out etc, I would like it to retry a specified
number of times, and when the update is succesful run -update swap-
and when the update quntinuous to fail I would like an error in a log or
somthing.

Look this would be very smart! :-)

However I cant fiugre out how to get hold on the right locals at the right
steps in the procedure. Can anyone of the more skilled members tell me?

A first draft of smart_update.do could be

        /* Check for updates */
        qui update query
        local adoinst = r(inst_ado)
        local adoavbl = r(avbl_ado)
        local exeinst = r(inst_exe)
        local exeavbl = r(avbl_exe)


        if `adoinst' != `adoavbl'  |  `exeinst'!=`exeavbl' {
          while ..... {
              update all
             ....
             }
          if `exeinst'!=`exeavbl' & [update were succesful] {
                    update swap
                    }
          if [update were NOT succesful] {
                     di "unsuccesfull update"
                     }
           }
         else {
           di "no updates needed"
           }


Kind regard


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
--------------------------------------------------------
Nicholas Winter 607.255.8819 t
Assistant Professor 607.255.4530 f
Department of Government nw53@cornell.edu e
308 White Hall falcon.arts.cornell.edu/nw53 w
Cornell University
Ithaca, NY 14853-4601
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index