HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/bin/webbackup/webbackup - Copy.cmd
rem SS, 24/3/06 version for 1and1 server
rem SS, 10/10/08 version for new 1and1 server
rem SS, 25/09/09 improved log to add date/time and dir of FTP folder, also send today's log as email
rem SS, 20/11/09 added backup to office web server (now new BE unlimited connection)
rem SS, 01/12/09 adjusted backup to office web server from 21 to 14 days due to limited space on c drive
rem SS, 04/03/10 added backup of c:\bin, moved ftp 1and1 from first to third position, start time adjusted from 2am to 3am
:: SS, 05/05/12 changed mysql backup to backup each database to a separate .sql file, easier to restore
:: SS, 06/05/12 changed to use 7-Zip instead of WinZip, improved look for log, with '---' and date time on one line, 
:: also file dates are nowin ISO format with hyphen separator (e.g. 06052012.zip becomes 2012-05-06.7z)
:: each database folder is listed and start time shown
:: SS, 07/05/12 minor improvements, separate webbak.zip and mysqldump.zip non longer created, last 7 days kept on server
:: SS, 08/05/12 moved the secure data, DNS, etc to the start after noticing it was taking 5 mins to add to zip, even though quite small in size
:: SS, 10/05/12 replaced two of the cmddate's with d:\bin\cmddate\cmddate-old to delete using old style dates
:: SS, 24/05/12 changed backups to delete from ontheworldweb.com from 31 to 65 days ago

d:
cd d:\bin\backup
echo ============================================================>logtoday.txt
echo %date% %time% Start>>logtoday.txt

rem --- delete backup of 7 days ago (only keep past 7 days)
cmddate -s -7 del d:\backups\#.7z>op.bat
:: (SS,7/5/12) set name of backup file YYYY-MM-DD.7z
cmddate -s 0 set bakfile=d:\backups\#.7z>>op.bat
call op.bat

echo ------------------------------------------------------------>>logtoday.txt
echo %date% %time% Start secure data, DNS, IIS Cfg zip>>logtoday.txt
rem --- secure data backup, added 26/4/06, SS
::del d:\backups\securedata.7z
:: wzzip d:\backups\securedata.zip d:\data\*.*  -rp -whs -ex -smaxis5oscaris10blahblah#~#~$*![(])blah456
:: (SS,6/5/12) winzip replaced with 7z
7z a -t7z -mx=9 -r -pmaxis5oscaris10blahblah#~#~$*![(])blah456 d:\backups\securedata.7z d:\data\*.*

rem --- IIS log backup
rem del d:\backups\iislogbak.zip
rem wzzip d:\backups\iislogbak.zip c:\windows\system32\logfiles\*.*  -rp -whs -ex

rem --- DNS backup
rem following 2 lines used because wzzip is 32 bit can't see the files in C:\WINDOWS\system32\dns
del d:\backups\dns\*.dns
copy C:\WINDOWS\system32\dns\*.dns d:\backups\dns

::del d:\backups\dnsbak.7z
:: wzzip d:\backups\dnsbak.zip d:\backups\dns\*.* -ex
:: (SS,6/5/12) winzip replaced with 7z
7z a -t7z -mx=9 d:\backups\dnsbak.7z d:\backups\dns\*.*

rem --- IIS Configuration backup (last saved)
::del d:\backups\iiscfgbak.7z
:: wzzip d:\backups\iiscfgbak.zip C:\windows\system32\inetsrv\*.* -rp -whs -ex
:: (SS,6/5/12) winzip replaced with 7z
7z a -t7z -mx=9 -r -pmaxis5 d:\backups\iiscfgbak.7z C:\windows\system32\inetsrv\*.*

rem --- bin folder backup (contains useful routines, SS, 4/3/10)
::del d:\backups\binbak.7z
:: wzzip d:\backups\binbak.zip d:\bin\*.* -rp -whs -ex
:: (SS,6/5/12) winzip replaced with 7z
7z a -t7z -mx=9 -r -pmaxis5 d:\backups\binbak.7z d:\bin\*.*

echo ------------------------------------------------------------>>logtoday.txt
echo %date% %time% Adding secure, DNS, IIS zips to zip>>logtoday.txt

rem --- add all to one file with today's date .zip
:: cmddate 0 wzzip d:\backups\#.zip @ziplist.txt>op.bat
:: (SS,6/5/12) winzip replaced with 7z
cmddate -s 0 7z a -t7z -mx=0 %bakfile% -i@7-ziplist.txt>op.bat
call op.bat

:: delete the added zips
del d:\backups\securedata.7z
del d:\backups\dnsbak.7z
del d:\backups\iiscfgbak.7z
del d:\backups\binbak.7z

echo ------------------------------------------------------------>>logtoday.txt
echo %date% %time% Start web folder zip>>logtoday.txt
del d:\backups\webbak.7z
:: wzzip d:\backups\webbak.zip d:\web\*.* -rp -whs -ex -smaxis5
:: (SS,6/5/12) winzip replaced with 7z and videos excluded
7z a -t7z -mx=9 -ms=256m -r -pmaxis5 %bakfile% d:\web -x!*.avi -x!*.mov -x!*.mpg

echo ------------------------------------------------------------>>logtoday.txt
echo %date% %time% Start mysqldump>>logtoday.txt
echo.>>logtoday.txt

rem --- mysql backup
rem --- use mysql dump command to do dump all the databases
rem (SS,21/3/12) added --routines to make sure functions and procedures are also backed up
rem NB. the --opt options does the following --add-drop-table --add-locks --create-options --disable-keys --extended-insert --lock-tables --quick --set-charset.
rem     all tables in a database are locked before the database is added to the dump

rem mysqldump --opt --user=root --password=oscaris10 --all-databases --routines >d:\backups\mysql_backup.sql

:: (SS,5/5/12) Replaced above with following to individually dump each db
:: go through each folder in mysql datafolder, running the mysqldump command for each database to the d:\backups\mysql folder
pushd "D:\MySQL Datafiles"
for /d %%f in (*) do mysqldump.exe --user=root --password=oscaris10 --routines --databases %%f > "d:\backups\mysql\%%f.sql"
popd
:: list sql files in name order
dir d:\backups\mysql /a-d >>logtoday.txt
:: list sql files in size order
::dir d:\backups\mysql /a-d /o-s >>logtoday.txt

echo ------------------------------------------------------------>>logtoday.txt
echo %date% %time% Start adding *.sql to zip>>logtoday.txt
rem delete previous zip
rem del d:\backups\mysql_backup.7z
rem --- zip it up
rem wzzip d:\backups\mysql_backup.zip d:\backups\mysql_backup.sql -whs -ex -smaxis5
rem (SS,3/5/12) replaced above with following, now held in folder
:: wzzip d:\backups\mysql_backup.zip d:\backups\mysql\*.sql -whs -ex -smaxis5
:: (SS,6/5/12) winzip replaced with 7z
7z a -t7z -mx=9 -ms=256m -r -pmaxis5 %bakfile% d:\backups\mysql

rem --- delete files which is now in zip
rem del d:\backups\mysql_backup.sql
rem (SS,3/5/12) replaced above with following, now more than one file held in new mysql folder
del d:\backups\mysql\*.sql



rem === START OF FTP ====

rem ==== FTP to home ====
echo ------------------------------------------------------------>>logtoday.txt
echo %date% %time% Start FTP to SS home server >>logtoday.txt
echo.>>logtoday.txt
rem --- build the FTP operations file
rem (SS,10/10/08) had to use open due to non standard port used
echo open ftp.ontheworldweb.com 5821>ftpop2.txt
echo backup>>ftpop2.txt
echo oscaris10>>ftpop2.txt
echo binary>>ftpop2.txt
rem following deletes backup file from 65 days ago, included the previous type DDMMYYYY.zip
cmddate -s -65 delete #.7z>>ftpop2.txt
d:\bin\cmddate\cmddate-old -65 delete #.zip>>ftpop2.txt
rem following uploads todays backup file
cmddate -s 0 put %bakfile%>>ftpop2.txt
echo dir>>ftpop.txt
echo quit>>ftpop2.txt
rem --- FTP the file to ontheworldweb server
ftp -s:ftpop2.txt>>logtoday.txt
rem ==== End of FTP to home ====

rem ==== FTP to 1and1 ====
echo ------------------------------------------------------------>>logtoday.txt
echo %date% %time% Start FTP to 1and1 server>>logtoday.txt
echo.>>logtoday.txt
rem --- build the FTP operations file
echo bak3418515>ftpop.txt
echo 3wwVvzVd>>ftpop.txt
echo binary>>ftpop.txt
rem following deletes backup file from 14 days ago, included the previous type DDMMYYYY.zip
cmddate -s -14 delete #.7z>>ftpop.txt
d:\bin\cmddate\cmddate-old -14 delete #.zip>>ftpop.txt
rem following uploads todays backup file
cmddate -s 0 put %bakfile%>>ftpop.txt
echo dir>>ftpop.txt
echo quit>>ftpop.txt
rem --- FTP the file to 1and1 server
ftp -s:ftpop.txt backup339.onlinehome-server.info>>logtoday.txt
rem ==== End of FTP to 1and1 ====


rem === END OF FTP ====

echo ------------------------------------------------------------>>logtoday.txt
echo %date% %time% Finish>>logtoday.txt
echo ============================================================>>logtoday.txt

:: append to main log file
echo. >>log.txt
type logtoday.txt >>log.txt
echo ------------------------------------------------------------------------------->>log.txt

:: send results in email
call sendemail.cmd