Loading ...
Sorry, an error occurred while loading the content.
 

How to query time and run at certain time with conditions

Expand Messages
  • smithsht
    Hi, This script has gone through several revs on this board. Now I need to take my existing script (below) and edit it in the follwing ways: Ensure host time
    Message 1 of 2 , Dec 6, 2001
      Hi,
      This script has gone through several revs on this board. Now I need
      to take my existing script (below) and edit it in the follwing ways:
      Ensure host time is correct ("net time \\time-server /set /y"), query
      time command, check to see if the time is within a certain window
      (10:45pm - 4am). If Yes, then run script in it's entirety. If No,
      goto :end of script.
      The idea is that if within time window, tape backup is cold; if not
      within time window, we at least have a hot backup.
      All help is greatly appreciated as always.
      shon
      _____________________________________________________________________

      @ECHO OFF

      :: shutdown.bat v2.0
      :: 11.15.01

      :: This script starts and stops various services so tape backup will
      be clean. Each
      :: command has error checking: error messages are echoed at command
      line then redirected to
      :: text file. Each subsequent error message is appended to file such
      that at end of
      :: either startup.bat or shutdown.bat script, all error messages will
      have been captured.
      :: If this file exists, it is then emailed to recipients using blat.
      We then delete this file
      :: for next cycle.

      :: Create temp shut.sql (overwrites it if it already exists)
      ECHO connect internal/oracle>shut.sql
      ECHO shutdown immediate>>shut.sql
      ECHO exit>>shut.sql

      :: Call "shut.sql" script, which stops oracle
      svrmgrl @...
      IF ERRORLEVEL 1 ECHO There was an error stopping oracle >
      D:\blat\blat_shutdown.txt

      :: Now delete sql file
      DEL shut.sql

      :: Stop net logon process
      net stop "net logon"
      IF ERRORLEVEL 1 ECHO There was an error stopping net logon >>
      D:\blat\blat_shutdown.txt

      :: Stop computer browser process
      net stop "computer browser"
      IF ERRORLEVEL 1 ECHO There was an error stopping computer browser >>
      D:\blat\blat_shutdown.txt

      :: Stop server process
      net stop server /y
      IF ERRORLEVEL 1 ECHO There was an error stopping server >>
      D:\blat\blat_shutdown.txt

      :: Stop docbase process
      netsvc "documentum docbase hostname" \\hostname /stop
      IF ERRORLEVEL 2 ECHO There was an error stopping docbase >>
      D:\blat\blat_shutdown.txt

      :: Stop docbroker process
      netsvc "documentum docbroker" \\hostname /stop
      IF ERRORLEVEL 2 ECHO There was an error stopping docbroker >>
      D:\blat\blat_shutdown.txt

      :: Start server process
      net start server
      IF ERRORLEVEL 1 ECHO There was an error starting server >>
      D:\blat\blat_shutdown.txt

      :: Start computer browser process
      net start "computer browser"
      IF ERRORLEVEL 1 ECHO There was an error starting computer browser >>
      D:\blat\blat_shutdown.txt

      :: Pause to ensure that docbase and docbroker are shutdown prior to
      starting backup
      sleep 120

      :: If file exists (i.e. if it was created by echoed error messages)
      pass it to blat to email
      If EXIST D:\blat\blat_shutdown.txt blat D:\blat\blat_shutdown.txt -t
      shon@... -s "Veritas shutdown script errors"

      :: Now delete the error messages file
      DEL D:\blat\blat_shutdown.txt


      :: Utilize the blat executable to send a confirmation email that the
      veritas shutdown script
      :: completed, whether failure or success.
      blat D:\blat\blat_shut_notify.txt -t shon@... -s "Veritas
      shutdown script complete"
    • Michael Marquart
      This small binary should help. On Thu, 06 Dec 2001 17:32:53 -0000, smithsht ... -- Regards, Michael -- Honk if you love peace and
      Message 2 of 2 , Dec 6, 2001
        This small binary should help.

        On Thu, 06 Dec 2001 17:32:53 -0000, "smithsht" <shon@...>
        wrote:

        >Hi,
        >This script has gone through several revs on this board. Now I need
        >to take my existing script (below) and edit it in the follwing ways:
        >Ensure host time is correct ("net time \\time-server /set /y"), query
        >time command, check to see if the time is within a certain window
        >(10:45pm - 4am). If Yes, then run script in it's entirety. If No,
        >goto :end of script.
        >The idea is that if within time window, tape backup is cold; if not
        >within time window, we at least have a hot backup.
        >All help is greatly appreciated as always.
        >shon

        --

        Regards,
        Michael

        --> Honk if you love peace and quiet.
      Your message has been successfully submitted and would be delivered to recipients shortly.