Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Making a .bat file to run by weekly for a backups

Posted on 2006-05-25
7
Medium Priority
?
1,039 Views
Last Modified: 2008-01-09
I would like to create an automatic batch file that run every 2 weeks it's a  "BlackBerryDbBackup.exe" application for backing up a Blackberry server database and then transfer the ".bak" to an network shared folder and then "Veritas" would back it up again on tape.  
Can I also have in the .bat file a “delete previous file” when running?...
The problem is that the backup file created doses not have the same name once the utility that does the backup run’s.

If the two weeks automatic back up can not be integrated in the .bat file, i can use the schedule task to run every two weeks as well.


C:\Program Files\Research In Motion\BlackBerry Enterprise Server\Utility> BlackBerryDbBackup -d BESMgmt -f C:\DB_backup_folder –E        <-- this currently works fine in .dos (CMD)... How ever it's manual and back's it up on the "C:\" locally.. i want it to copy it to a share drive on an other server ex: \\server\shared and if possible override or delete the previous .bak on the same token.

I hope this was well detailed any help would be great.
Thank you
0
Comment
Question by:CareConnect
  • 4
  • 3
7 Comments
 
LVL 8

Expert Comment

by:harris_c
ID: 16767099
BlackBerryDbBackup -d BESMgmt -f \\server\shared –E   <-- write this one in a bat file then add to scheduler.

what is the name of the previous .bak?


hec",)
0
 

Author Comment

by:CareConnect
ID: 16768026
Hi Harris,

Yeah actaly i did and that worked.. but i have to put it in the root of where the utilitly is.. that 's ok
all previous .bak are name with date and time spamp.bak ex" 2006052611321.bak" year, month, day, hour, minute, second.. i am not sure the bat can delete that way the old one if it never has a same name?
Cheers
0
 
LVL 8

Expert Comment

by:harris_c
ID: 16769430
Hi CareConnect,

If you do not wish to use scripting language then a little trick is possible.

::rename all backups to something unique
ren *.bak *.~bk

::run the program
BlackBerryDbBackup -d BESMgmt -f \\server\shared –E

::ok, the program created its own .bak file right?
::but then, we renamed previous .bak files to .~bk =)
::so now we can delete them =)
del *.~bk


OR

::why cant we just do a
del *.bak
BlackBerryDbBackup -d BESMgmt -f \\server\shared –E


hec",)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:CareConnect
ID: 16771285
Hi Hec, this is the comand

BlackBerryDbBackup -d BESMgmt -f \\shared\Home$\folder -E
del *.bak  \\shared\Home$\folder

Works BUT... it promps you to:
"Could not find c:\program files\research in motion\blackberry enterprise server\utility\*.bak"
then a question: "*, are u sure (Y/N)?
then when i click Yes, it totaly empty the folder on the \\share and does not delete the previous .bak and dosent create a new .bak
Thank


 
0
 
LVL 8

Expert Comment

by:harris_c
ID: 16771850
oopps... try this

BlackBerryDbBackup -d BESMgmt -f \\shared\Home$\folder -E
del /Q /F \\shared\Home$\folder\*.bak



  /P            Prompts for confirmation before deleting each file.
  /F            Force deleting of read-only files.
  /S            Delete specified files from all subdirectories.
  /Q            Quiet mode, do not ask if ok to delete on global wildcard
  /A            Selects files to delete based on attributes
0
 
LVL 8

Accepted Solution

by:
harris_c earned 2000 total points
ID: 16771877
::delete all backup files
del /Q /F \\shared\Home$\folder\*.bak

::do our stuff, this would create a single bak file
BlackBerryDbBackup -d BESMgmt -f \\shared\Home$\folder -E
0
 

Author Comment

by:CareConnect
ID: 16784496
Hi Harris, it finaly worked.
 
I had to reverse the order of the lines other wise it would of delete all the .bak in that folder.
Thank you!

del /Q/F \\shared\Home$\folder\*.bak
BlackBerryDbBackup -d BESMgmt -f \\sharedr\Home$\folder -E
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question