[AccessD] Automatic backup
James Button
jamesbutton at blueyonder.co.uk
Thu Mar 17 10:52:17 CDT 2016
While it is easy to initiate a backup (.cmd) script to run - trigger the script
as an 'on open' - so it cannot run immediately before the db is open
I suspect your main problem will to have that file-copy process wait until all
the users have finished their sessions
And to deal with sessions abandoned without closing the db or running a command
that follows the db usage command
Have an 'own composed' program that will, at a set interval, look to see if it
can get full access to the db - just sitting there checking - every minute?
And then end when the db is not in use elsewhere
Then - the backup is initiated from the db being opened - start the wait-4-it
script , and it can be copied to a folder with a timestamp I the name - or on
the actual copy.
The code for the exclusive access depends on the language you will use - I
thought it would be easy to get sample code - but google is not being
co-operative.
Maybe you can use bits from this code as a help for timestamping
Echo off
set
btimest=%date:~6,4%-%date:~3,2%-%date:~0,2%.%time:~0,2%.%time:~3,2%.%time:~6,2%
for /F "delims=/-: tokens=1,2,3" %%H in (pfile.log) do (
set bdatest=%%I-%%H-%%J
set bdaterc=%%J%%I%%H
)
Echo %btimest% %bdatest% >nul:
Echo btimest (%btimest%) is the datetime entry for the folder >nul:
Echo bdatest (%bdatest%) is the date of the prior run from the logfile >nul:
Echo on
cd "\backup of c"
mkdir "%USERNAME% on %btimest%"
cd "%USERNAME% on %btimest%"
echo %date%-%Time% >pfile.log
------------------
There is also the useful tee.exe - a program to split the output stream into 2 -
one to the 'screen' and 1 to a logfile
JimB
-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of FW
Salato Center
Sent: Thursday, March 17, 2016 2:28 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Automatic backup
Yes, an example would be very much appreciated! :)
Susan H.
You can't do that inside in any easy way from inside your app while it's
executing. To keep things simple, just setup a batch file with a shortcut
on the desktop. The batch file doesn't have to be anything more than a file
copy and you'll probably want to suffix the date/time on that. Let me know if
you want an example.
Your other option would be to write it in VBA in a small utility DB, again
assuming you want to keep it simple.
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
More information about the AccessD
mailing list