diff --git a/.gitignore b/.gitignore index eac7b00..86fa406 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ *.exe *.log -!snapcontrol.exe diff --git a/README.md b/README.md index ab503a2..ae4a183 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,55 @@ # Snapcontrol + +## Short description + Drive snapshot backup controller. A backup wrapper program for Windows boxes. - - Starts a backup via Windows Scheduler using Drive Snapshot - - Asks the user for permission to start backup - - Different backup targets (LOCAL drive, SMB, FTP) - - Encryption support (via Drive Snapshot) - - Verifies the backup (optional) - - Full backup every month - - Daily differential backup - - Writes detailed logfile and history log - - Sends reports via email +Features: +- Starts a backup via Windows Scheduler using Drive napshot by Tom Ehlert +- Asks the user for permission to start backup +- Can do a shutdown after backup +- Different backup targets (local DRIVE, SMB, FTP) +- Encryption support (via Drive Snapshot) +- Verifies the backup (optional) +- New full backup every month +- Daily differential backup +- Writes detailed logfile and history log +- Sends reports via email -This tool creates image based backups of windows machines. It uses the [Drive Snapshot](http://www.drivesnapshot.de/en/order.htm) tool by Tom Ehlert Software. Please support this great tool and buy a license. -It is a - so called - wrapper program. +## Requirements + +You will need the tool [Drive Snapshot](http://www.drivesnapshot.de/en/order.htm) by Tom Ehlert Software. + +Download here: [snapshot.exe](http://www.drivesnapshot.de/download/snapshot.exe) +64-bit version: [snapshot64.exe](http://www.drivesnapshot.de/download/snapshot64.exe) + +You can test Drive snapshot for a limited time. Please support this great tool and consider to buy a license. + + +## Installation + +- Download the latest release and unzip the files +- Open "snapcontrol.ini" with the editor of your choice and set the following variables: + - BinPath + - TargetPath + - TargetUser + - TargetPassword + - Disks2Dump +- Copy the Drive Snapshot binary to "BinPath" +- Optional step: set "InstallTo" to your desired location +- Open a dos box and execute: + +```dos +snapcontrol.exe /I +``` + +( Snapcontrol copies the config file and itself to the location of the "InstallTo" variable. ) + +That's all snacpcontrol wil be called by the Windows scheduler. See "snapcontrol.ini" for detailed comments on the features. -This is a short description. Detailed documentation follows in the next days. ## USAGE @@ -30,75 +62,4 @@ usage: snapcontrol.exe /V = show version ``` -```dos -C:\>snapcontrol.exe /V -Version = V1.02 -``` - -## Example run - -```dos -[2021.05.25 (23:57:07)] ============== starting BACKUP ============== -[2021.05.25 (23:57:07)] snapcontrol.exe version = [ V1.02 ] -[2021.05.25 (23:57:07)] snapshot.exe version = [ V1.48 ] -[2021.05.25 (23:57:07)] OK. Running as Admin ... -[2021.05.25 (23:57:07)] INFO: using a NETWORK share for backup ... -[2021.05.25 (23:57:07)] INFO: found [ MARS_snapshot_05_ful_C.sna ] -[2021.05.25 (23:57:07)] INFO: found [ MARS_snapshot_05_ful_HD1-1.sna ] -[2021.05.25 (23:57:07)] INFO: Starting QUICKCHECK for [ MARS_snapshot_05_ful_C.sna ] - - -23:57:07 Start of Snapshot 1.48.18895 [May 6 2021] at 25.05.2021 -23:57:07 Running on Windows 10 Professional 64-bit (19042) -23:57:07 Memory Info: Total: 7887Mb, Free: 4645Mb, Pagefile total: 9103Mb, Pagefile free: 5835Mb -23:57:07 Command line: c:\tools\snapshot64.exe --Logfile:c:\snapshot\backup.log --QuickCheck:\\bar\drive\image\MARS_snapshot_05_ful_C.sna -23:57:07 The file structure of \\bar\drive\image\MARS_snapshot_05_ful_C.sna is okay. -23:57:07 End of Snapshot 1.48 [May 6 2021] at 25.05.2021 -[2021.05.25 (23:57:07)] INFO: Starting QUICKCHECK for [ MARS_snapshot_05_ful_HD1-1.sna ] - - -23:57:07 Start of Snapshot 1.48.18895 [May 6 2021] at 25.05.2021 -23:57:07 Running on Windows 10 Professional 64-bit (19042) -23:57:07 Memory Info: Total: 7887Mb, Free: 4642Mb, Pagefile total: 9103Mb, Pagefile free: 5835Mb -23:57:07 Command line: c:\tools\snapshot64.exe --Logfile:c:\snapshot\backup.log --QuickCheck:\\bar\drive\image\MARS_snapshot_05_ful_HD1-1.sna -23:57:07 The file structure of \\bar\drive\image\MARS_snapshot_05_ful_HD1-1.sna is okay. -23:57:07 End of Snapshot 1.48 [May 6 2021] at 25.05.2021 -[2021.05.25 (23:57:07)] INFO: executing command [ c:\tools\snapshot64.exe ] -[2021.05.25 (23:57:07)] DumpFile: [ \\bar\drive\image\MARS_snapshot_05_$type_$disk.sna ] -[2021.05.25 (23:57:07)] HashFile: [ -h\\bar\drive\image\MARS_snapshot_05_$type_$disk.hsh ] -[2021.05.25 (23:57:07)] LogFile: [ c:\snapshot\backup.log ] - - -23:57:08 Start of Snapshot 1.48.18895 [May 6 2021] at 25.05.2021 -23:57:08 Running on Windows 10 Professional 64-bit (19042) -23:57:08 Memory Info: Total: 7887Mb, Free: 4641Mb, Pagefile total: 9103Mb, Pagefile free: 5836Mb -23:57:08 Command line: c:\tools\snapshot64.exe --Logfile:c:\snapshot\backup.log -T --EjectDriveAfterBackup --NetUse:\\bar\drive\image,guest,******************** --FullIfHashIsMissing --CreateDir -W -L65536 HD1:* \\bar\drive\image\MARS_snapshot_05_$type_$disk.sna -h\\bar\drive\image\MARS_snapshot_05_$type_$disk.hsh -23:57:10 Disks in backup: -23:57:10 C: -> \\bar\drive\image\MARS_snapshot_05_dif_C.sna -23:57:10 HD1:1 -> \\bar\drive\image\MARS_snapshot_05_dif_HD1-1.sna -23:57:10 Preparing for backup -23:57:10 Drive HD1:1 is not supported by the Volume Shadow copy service -23:57:23 No exchange writer involved, using internal backup engine -23:57:24 Start differential backup of C: -> \\bar\drive\image\MARS_snapshot_05_dif_C.sna -23:57:24 free space info: total 244.095MB, 199.181MB free, 43.698MB must be saved -23:57:24 C: -> \\bar\drive\image\MARS_snapshot_05_dif_C.sna -23:59:11 4 sectors need more than 100ms to read -23:59:11 C: 44.914MB in use - stored in 26.228KB - 1:47 minutes -23:59:11 Success -23:59:11 Start verification of: \\bar\drive\image\MARS_snapshot_05_dif_C.sna -23:59:12 Success! -23:59:12 Start differential backup of HD1:1 -> \\bar\drive\image\MARS_snapshot_05_dif_HD1-1.sna -23:59:12 free space info: total 102.396KB, 75.424KB free, 26.972KB must be saved -23:59:13 HD1:1 -> \\bar\drive\image\MARS_snapshot_05_dif_HD1-1.sna -23:59:13 HD1:1 26.972KB in use - stored in 1.040KB - 0:00 minutes -23:59:13 Success -23:59:13 Start verification of: \\bar\drive\image\MARS_snapshot_05_dif_HD1-1.sna -23:59:13 Success! -23:59:13 Snapshot finished successfully -23:59:13 End of Snapshot 1.48 [May 6 2021] at 25.05.2021 -[2021.05.25 (23:59:13)] INFO: END of BACKUP with result SUCCESS ! -[2021.05.25 (23:59:13)] return=0 -[2021.05.25 (23:59:13)] INFO: sending mail to: michael@schmidt2.de -[2021.05.25 (23:59:13)] INFO: MailServer = smtp.gmail.com -[2021.05.25 (23:59:14)] INFO: mail sent -``` +Everytime you change the values in "BackupSched" or "BackupStart" you will have to call snapcontrol.exe with the /U switch. diff --git a/snapcontrol.exe b/snapcontrol.exe deleted file mode 100644 index 650b1d6..0000000 Binary files a/snapcontrol.exe and /dev/null differ diff --git a/snapcontrol.pb b/snapcontrol.pb index fedfe56..2e119c9 100644 --- a/snapcontrol.pb +++ b/snapcontrol.pb @@ -7,7 +7,7 @@ ; LICENSE : MIT License ; AUTHOR : Michael H.G. Schmidt ; EMAIL : michael@schmidt2.de -; DATE : 20210528 +; DATE : 20210530 ; ------------------------------------------------------------ ; ; This tool creates an image backups of windows machines, @@ -29,7 +29,7 @@ EnableGraphicalConsole(0) Dim filelist$(0) -Global VERSION$="V1.04" +Global VERSION$="V1.05" Global installme = 0 Global updatesched = 0 Global dryrun = 0 @@ -95,43 +95,43 @@ If (Not OpenPreferences(inifile$)) EndIf PreferenceGroup("install") -Global InstallTo$ = ReadPreferenceString("InstallTo","c:\snapshot") -Global BinPath$ = ReadPreferenceString("BinPath","c:\tools") +Global InstallTo$ = Trim(ReadPreferenceString("InstallTo","c:\snapshot")) +Global BinPath$ = Trim(ReadPreferenceString("BinPath","c:\tools")) PreferenceGroup("backup") -Global TargetPath$ = ReadPreferenceString("TargetPath","\\server\share") -Global FtpBackup$ = ReadPreferenceString("FtpBackup","no") -Global FtpServer$ = LCase(ReadPreferenceString("FtpServer","none")) -Global TargetUser$ = ReadPreferenceString("TargetUser","guest") -Global TargetPassword$ = ReadPreferenceString("TargetPassword","guest") -Global BackupschedMode$ = LCase(ReadPreferenceString("BackupschedMode","login")) -Global BackupStart$ = ReadPreferenceString("BackupStart","0005:00") -Global Disks2Dump$ = ReadPreferenceString("Disks2Dump","HD1:*") -Global ExcludeList$ = ReadPreferenceString("ExcludeList","") -Global DumpSize$ = ReadPreferenceString("DumpSize","4095") -Global Verify$ = LCase(ReadPreferenceString("Verify","yes")) -Global BurnTrash$ = LCase(ReadPreferenceString("BurnTrash","no")) -Global Encrypt$ = LCase(ReadPreferenceString("Encrypt","no")) -Global EncryptPW$ = ReadPreferenceString("EncryptPW","") -Global LimitIO$ = ReadPreferenceString("LimitIO","") -Global EjectMedia$ = LCase(ReadPreferenceString("EjectMedia","yes")) -Global AskForShutdown$ = LCase(ReadPreferenceString("AskForShutdown","no")) +Global TargetPath$ = Trim(ReadPreferenceString("TargetPath","\\server\share")) +Global FtpBackup$ = Trim(ReadPreferenceString("FtpBackup","no")) +Global FtpServer$ = Trim(LCase(ReadPreferenceString("FtpServer","none"))) +Global TargetUser$ = Trim(ReadPreferenceString("TargetUser","guest")) +Global TargetPassword$ = Trim(ReadPreferenceString("TargetPassword","guest")) +Global BackupschedMode$ = Trim(LCase(ReadPreferenceString("BackupschedMode","login"))) +Global BackupStart$ = Trim(ReadPreferenceString("BackupStart","0005:00")) +Global Disks2Dump$ = Trim(ReadPreferenceString("Disks2Dump","HD1:*")) +Global ExcludeList$ = Trim(ReadPreferenceString("ExcludeList","")) +Global DumpSize$ = Trim(ReadPreferenceString("DumpSize","4095")) +Global Verify$ = Trim(LCase(ReadPreferenceString("Verify","yes"))) +Global BurnTrash$ = Trim(LCase(ReadPreferenceString("BurnTrash","no"))) +Global Encrypt$ = Trim(LCase(ReadPreferenceString("Encrypt","no"))) +Global EncryptPW$ = Trim(ReadPreferenceString("EncryptPW","")) +Global LimitIO$ = Trim(ReadPreferenceString("LimitIO","")) +Global EjectMedia$ = Trim(LCase(ReadPreferenceString("EjectMedia","yes"))) +Global AskForShutdown$ = Trim(LCase(ReadPreferenceString("AskForShutdown","no"))) PreferenceGroup("logging") -Global LogFile$ = ReadPreferenceString("LogFile","backup.log") -Global HistLog$ = ReadPreferenceString("HistLog","history.log") +Global LogFile$ = Trim(ReadPreferenceString("LogFile","backup.log")) +Global HistLog$ = Trim(ReadPreferenceString("HistLog","history.log")) ; add PATH to logfiles ... LogFile$ = InstallTo$ + "\" + LogFile$ HistLog$ = InstallTo$ + "\" + HistLog$ PreferenceGroup("mail") -Global MailReport$ = LCase(ReadPreferenceString("MailReport","no")) -Global MailTo$ = ReadPreferenceString("MailTo","") -Global MailServer$ = ReadPreferenceString("MailServer","") -Global MailPort = Val(ReadPreferenceString("MailPort","")) -Global MailUser$ = ReadPreferenceString("MailUser","") -Global MailPass$ = ReadPreferenceString("MailPass","") +Global MailReport$ = Trim(LCase(ReadPreferenceString("MailReport","no"))) +Global MailTo$ = Trim(ReadPreferenceString("MailTo","")) +Global MailServer$ = Trim(ReadPreferenceString("MailServer","")) +Global MailPort = Val(Trim(ReadPreferenceString("MailPort",""))) +Global MailUser$ = Trim(ReadPreferenceString("MailUser","")) +Global MailPass$ = Trim(ReadPreferenceString("MailPass","")) ; which Drive Snapshot version should be used ? arch$ = GetEnvironmentVariable("PROCESSOR_ARCHITECTURE") @@ -559,8 +559,8 @@ EndProg(e) ; IDE Options = PureBasic 5.73 LTS (Windows - x64) ; ExecutableFormat = Console -; CursorPosition = 384 -; FirstLine = 351 +; CursorPosition = 103 +; FirstLine = 99 ; Folding = -- ; EnableXP ; Executable = snapcontrol.exe