Re: Maintain backup directory



Pegasus,

thanks so far. When I run the script (after setting target to the right
location and removing line numbers), the script wants to "echo delete" a
configuration file (backupplace.cfg) that resides inside the directory. I
assume the script goes for it because its the oldest file out there. Can you
modify the script to only handle files with the .tib extension?

Tom



"Pegasus (MVP)" <I.can@xxxxxxxxxx> wrote in message
news:OtRxQjoBJHA.4884@xxxxxxxxxxxxxxxxxxxxxxx

"Tom Tyson" <no@xxxxxxxx> wrote in message
news:g8sh1k$9l2$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi folks,

I am currently running XP SP3 and use TrueImage 10 to run a scheduled
task (nightly) to perform a differental backup of my primary HD onto an
external USB HD. TrueImage allows for setting both pre- and post-job
commands. I use the post-job command to shutdown my system via
'shutdown -s' (energy is expensive here in Europe, too ;)

The initial image is about 80-90 gb, the differental backups are created
at about 15 gb each daily. Consequently, the backup media runs out of
disk space after a while. In this case, TrueImage fails to do the job.

My idea was to use a pre-job script to look at the backup directory and
make sure there is sufficient space for the pending job to complete.
Looking at the growth rate of past jobs, I would consider 1.5 times the
size of the latest differental job (by date) as a good measure. Example:

Backup Dir with:

backup.tib => 80GB
backup1.tib => 13GB (dated: 8/8/08)
backup2.tib => 14GB (dated: 8/9/08)
backup3.tib => 16GB (dated: 8/10/08)
backup4.tib => 18GB (dated: 8/11/08)


In this case, I would want the script to clean up 27 GB of space, which
would mean delete backup1 and backup2 before the backup process starts.
The script may neither delete the master backup (backup.tib) nor the
latest differental file (backup4). If these constraints do not allow for
further execution of the script, I think I should be informed and
manually move the contents of the backup drive to a safe location, delete
all and start over with a fresh master backup. This could also be done by
script if a 2nd backup device was present. So be aware of my next post ;)

Some of you might have noticed that I'm fairly new to backup strategies
:) Be aware that I'm only trying to maintain my home office, so I'm not
hurting anyone!
Thanks in advance for your input,

Tom

Below is a batch file answer to your question. Here is how to apply it:
- Adjust Lines #2-4 to suit your requirements. Line #4 gives your
growth margin (150 stands for 150%, or 1.5).
- Unwrap any lines that your newsreader might have wrapped.
- Remove the line numbers.
- Run the batch file and watch what happens. It won't delete any files!
- Remove the word "echo" from Line #18 to enable the file deletion.
- When you're happy with the result, remove Line #19.

01. @echo off
02. set Target=d:\My Backups
03. set FullName=backup.tib
04. set Factor=150
05.
06. for /F %%a in ('dir /b /od "%Target%"') do set Newest=%%a
07. for %%a in ("%Target%\%Newest%") do set NSize=%%~za
08. set NSize=%NSize:~0,-6%
09.
10. :Again
11. for /F "tokens=3" %%a in ('dir /-C "%Target%" ^| find /i "bytes
free"') do set Free=%%a
12. set Free=%Free:~0,-6%
13. set /a Needed=%NSize% * %Factor% / 100
14.
15. if %Needed% LSS %Free% goto :eof
16. for /F "delims=" %%a in ('dir /b /o-d "%Target%"') do if /i not
"%%a"=="%FullName%" set Oldest=%%a
17. if /i "%Oldest%"=="%Newest%" goto Notify
18. echo del "%Target%\%Oldest%"
19. pause
20. goto Again
21.
22. :Notify
23. blat.exe /.. /.. /..
24. rem blat.exe is a downloadable command line mailer




.



Relevant Pages

  • Re: /usr/informix/bin/onbar[84]: 22716 Memory fault
    ... write debug traces (setting BAR_DEBUG parameter in onconfig ... I'm getting the above error when running onbar from a script. ... echo EORROR_NUMBER before backup is equal to 0 ...
    (comp.databases.informix)
  • Feedback on backup script
    ... The one problem I have is that the script keeps stopping at lines 633,635 and or 637 with the error "Path Not Found" I have emailed the original author for help but haven't heard back yet. ... I was just wondering if the problem could be that the account running the script doesn't have correct permissions to a share/directory/file that it's trying to backup? ... ' always one less than the actual number of folders. ... ' Show the user free space info on all available disk drives ...
    (microsoft.public.scripting.vbscript)
  • Re: [SLE] Backup to CD/DVD -- recommended software?
    ... Here is the script I have used for CD-Rbackup of a specific ... Next is the CD-RW backup script. ... echo We are in the datasheets.CD-RW.backup script! ... failing to match md5sums or getting IO errors ...
    (SuSE)
  • Re: backup strategy (was Re: reconstruct the system)
    ... > If my backup scripts don't quite do it for you, ... Here's my script. ... echo $NAME>> $TARDIR/$READMEFILENAME ... echo "Tarring various stuff ..." ...
    (Debian-User)
  • Re: Maintain backup directory
    ... When I run the script (after setting target to the right ... Consequently, the backup media runs ... Remove the word "echo" from Line #18 to enable the file deletion. ...
    (microsoft.public.scripting.wsh)

Loading