« Drive Mappings | Main | Cousins - Madison, MS - 12/22/2010 »

January 20, 2019

Nightly PeenieWallie Backup/Archive

I have a scheduled backup/archive of my pw web server every morning at 3:00 a.m.

The backup is copying/archiving the entire pw website as described below:

1) It stops the MySQL database, and then dumps/exports the MySQL database to the following location:

s:\pw\MySQL\backups\pw_backup_%DATEN%.sql

[deleted backups prior to 1/1/2019]

2) It copies the MySQL data files ibdata1, ib_logfile0, ib_logfile1 to the following locations:

copy ib_logfile0 s:\pw\mysql\data\ib_logfile0
copy ib_logfile0 s:\pw\mysql\data\ib_logfile0_%DATEN%
copy ib_logfile1 s:\pw\mysql\data\ib_logfile1
copy ib_logfile1 s:\pw\mysql\data\ib_logfile1_%DATEN%
copy ibdata1 s:\pw\mysql\data\ibdata1
copy ibdata1 s:\pw\mysql\data\ibdata1_%DATEN%

[deleted backups prior to 1/1/2019]

3) It stops the Apache web server, and then runs SyncToy to copy all of the static files in the "D:\Inetpub" folder structure to the "S:\pw\Inetpub" folder structure.

So, these are where my nightly backups/archives are going. Now, I've cleaned them up some by deleting all of the backups that were created before 1/1/2019.

My backup that runs is in Task Scheduler. It runs every morning at 3:00 a.m. It's named "backup.bat".

======================================================
"c:\Program Files (x86)\MySQL\MySQL Server5.1\bin\backup.bat"
======================================================

FOR /f "tokens=2 delims= " %%D in ('echo %DATE:/=%') do SET DATEN=%%D

c:
cd C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin\
mysqldump -a -uroot -pnewark01 pw > "s:\pw\MySQL\backups\pw_backup_%DATEN%.sql"

net stop mysql
cd C:\ProgramData\MySQL\MySQL Server 5.1\data\
copy ibdata1 s:\pw\mysql\data\ibdata1
copy ibdata1 s:\pw\mysql\data\ibdata1_%DATEN%
copy ib_logfile0 s:\pw\mysql\data\ib_logfile0
copy ib_logfile0 s:\pw\mysql\data\ib_logfile0_%DATEN%
copy ib_logfile1 s:\pw\mysql\data\ib_logfile1
copy ib_logfile1 s:\pw\mysql\data\ib_logfile1_%DATEN%
net start mysql

REM Stops Apache web server
"C:\Program Files (x86)\Apache Group\Apache2\bin\Apache.exe" -w -n "Apache2" -k stop

REM Runs SyncToy for Inetpub folder structure C:\INETPUB\ >>> \\DISKSTATION\Simon\pw\Inetpub
rem "c:\Program Files (x86)\SyncToy 2.1\SyncToyCmd.exe" -R "Inetpub2"
"c:\Program Files\SyncToy 2.1\SyncToyCmd.exe" -R "Inetpub2"

REM Restart Apache web server
"C:\Program Files (x86)\Apache Group\Apache2\bin\Apache.exe" -w -n "Apache2" -k start

Deleting old backups:

So, if I go to the following directory, I do see my old archives out there. These are the nightly archives/exports of the MySQL database.

ib_logfile0
ibdata1
ib_logfile1

ib_logfile0_01202019
ibdata1_01202019
ib_logfile1_01202019

So, it looks like I have backups going back to 10012017. I deleted all of my MySQL archives prior to 1/1/2019.

S:\pw\MySQL\data

Posted by Rob Kiser on January 20, 2019 at 10:26 PM

Comments

Post a comment




Remember Me?

(you may use HTML tags for style)


NOTICE: IT WILL TAKE APPROX 1-2 MINS FOR YOUR COMMENT TO POST SUCCESSFULLY. YOU WILL HAVE TO REFRESH YOUR BROWSER. PLEASE DO NOT DOUBLE POST COMMENTS OR I WILL KILL YOU.