Windows Vista Forums

Need help with Backup Script
  1. #1


    JohnnyD Guest

    Need help with Backup Script

    I need help with writing some vb script. I am a very novice scripter
    and have no idea where to begin. I have a batch file backup script
    that exports the db file from a live running Sybase database shortly
    before ShadowProtect (backup program) images the drive, since Sybase
    is not VSS compatible. Here is my script:

    CD\
    D:
    CD Eaglesoft\Shared Files
    DBBACKUP -d -t -c "eng=eaglesoft;uid=dba;pwd=sql" "D:\Online_Backup"

    The trouble I am having is that sometimes "dbbackup" does not finish
    the export and hangs somewhere in the process. I need a script that
    will:

    1. kill dbackup.exe running in windows 2003 server processes if the
    script does not complete in 5 minutes and restart the script again.
    2. Put a "failed" entry in the windows event log when it fails and
    needs to be restarted.

    Right now, I run this script as a batch file but imagine we would need
    to make it a vb script to accommodate the extra functionality

    Thanks Very Much,

    John Newcomb



      My System SpecsSystem Spec

  2. #2


    Pegasus \(MVP\) Guest

    Re: Need help with Backup Script


    "JohnnyD" <johndnewcomb@xxxxxx> wrote in message
    news:1f65b752-b5f9-4d29-b270-cf144979fe7d@xxxxxx

    >I need help with writing some vb script. I am a very novice scripter
    > and have no idea where to begin. I have a batch file backup script
    > that exports the db file from a live running Sybase database shortly
    > before ShadowProtect (backup program) images the drive, since Sybase
    > is not VSS compatible. Here is my script:
    >
    > CD\
    > D:
    > CD Eaglesoft\Shared Files
    > DBBACKUP -d -t -c "eng=eaglesoft;uid=dba;pwd=sql" "D:\Online_Backup"
    >
    > The trouble I am having is that sometimes "dbbackup" does not finish
    > the export and hangs somewhere in the process. I need a script that
    > will:
    >
    > 1. kill dbackup.exe running in windows 2003 server processes if the
    > script does not complete in 5 minutes and restart the script again.
    > 2. Put a "failed" entry in the windows event log when it fails and
    > needs to be restarted.
    >
    > Right now, I run this script as a batch file but imagine we would need
    > to make it a vb script to accommodate the extra functionality
    >
    > Thanks Very Much,
    >
    > John Newcomb
    Save the code below in c:\Tools\ByBackup.bat:
    01. @echo off
    02. set app=calc.exe
    03. set parms=-d -t -c "eng=eaglesoft;uid=dba;pwd=sql" "D:\Online_Backup"
    04. set delay=10
    05.
    06. if not "%1"=="" goto Wait
    07. start /b "Timer" c:\Tools\MyBackup.bat xxx
    08. cd /d "d:\Eaglesoft\Shared Files"
    09. %app% %parms%
    10. if exist c:\Tools\MyBackup.flag (c:\Tools\MyBackup.bat) else (goto :eof)
    11.
    12. :Wait
    13. if exist c:\Tools\MyBackup.flag del c:\Tools\MyBackup.flag
    14. ping localhost -n %delay% > nul
    15. tasklist | find /i "%app%" || goto :eof
    16. echo %date% %time% > c:\Tools\MyBackup.flag
    17. taskkill /f /im %app%
    18. eventcreate.exe /.. /..

    Explanation:
    Lines 1..3: Adjust them to suit your requirements. Use calc.exe for testing
    purposes, dbbackup.exe for the real thing.
    Line 7: Start a second instance of c:\Tools\MyBackup.bat. The parameter xxx
    ensures that the code after the ":Wait" label is executed. This instance
    will run concurrently with the main part of the batch file.
    Lines 8..9: Launch the backup process.
    Line 10: Relaunch c:\Tools\MyBackup.bat if the first run failed.
    Line 13: Delete the semaphore file if it exists.
    Line 14: Pause for %delay% seconds.
    Line 15: Exit if dbbackup.exe is no longer resident.
    Line 16: Generate the semaphore file. It will be polled by Line 10.
    Line 17: Kill dbbackup.exe.
    Line 18: Create an event in the Event Logger.

    Note: If you save this code under a name other than c:\Tools\MyBackup.bat
    then you must adjust Lines 7 and 10 accordingly.
    You probably need to add a counter so that the job doesn't run in circles
    forever . . .



      My System SpecsSystem Spec

Need help with Backup Script problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Script to Run System Backup in Vista Mike VB Script 1 15 Feb 2010
Backup script and UAC conflict JonathanL Vista General 0 26 Mar 2009
Newbie question - Is there a script/command to do a backup of a di dob PowerShell 4 03 Jan 2008
backup script Ryan PowerShell 5 16 Apr 2007
backup script Ryan PowerShell 0 16 Apr 2007