new Release
This commit is contained in:
parent
1cefb988a0
commit
499cd1487b
10
README.md
10
README.md
@ -3,12 +3,12 @@
|
||||
|
||||
## Short description
|
||||
|
||||
Drive snapshot backup controller.
|
||||
Drive Snapshot backup controller.
|
||||
A backup wrapper program for Windows boxes.
|
||||
|
||||
Features:
|
||||
- Starts a backup via Windows Scheduler using Drive Snapshot by Tom Ehlert
|
||||
- Asks the user for permission to start backup
|
||||
- Can ask the user for permission to start a backup
|
||||
- Can do a shutdown after backup
|
||||
- Different backup targets (local DRIVE, SMB, FTP)
|
||||
- Encryption support (via Drive Snapshot)
|
||||
@ -16,7 +16,7 @@ Features:
|
||||
- New full backup every month
|
||||
- Daily differential backup
|
||||
- Writes detailed logfile and history log
|
||||
- Sends reports via email
|
||||
- Sends reports via email (using cmail.exe)
|
||||
|
||||
|
||||
## Requirements
|
||||
@ -28,6 +28,9 @@ Download here: [snapshot.exe](http://www.drivesnapshot.de/download/snapshot.exe)
|
||||
|
||||
You can test Drive snapshot for a limited time. Please support this great tool and consider to buy a license.
|
||||
|
||||
You will also need [CMail](https://www.inveigle.net/cmail) for sending emails.
|
||||
Get it from here: https://www.inveigle.net/cmail/download
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
@ -63,3 +66,4 @@ usage: snapcontrol.exe </I | /U | /D | /V>
|
||||
```
|
||||
|
||||
Everytime you change the values in "BackupSched" or "BackupStart" you will have to call snapcontrol.exe with the /U switch.
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
; where to install the exe and the infile ...
|
||||
InstallTo = c:\snapshot
|
||||
|
||||
; path where snapshot.exe is located ...
|
||||
; path where snapshot.exe and cmail.exe is located ...
|
||||
BinPath = c:\tools
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ BinPath = c:\tools
|
||||
; - "/backup" (some path on FTP server)
|
||||
TargetPath = D:\BACKUP
|
||||
|
||||
; active FTP backup with "yes"
|
||||
; activate FTP backup with "yes"
|
||||
FtpBackup = no
|
||||
|
||||
; name of ftp server
|
||||
@ -94,23 +94,30 @@ HistLog = history.log
|
||||
|
||||
[MAIL]
|
||||
;
|
||||
; The mail setup in this config file was tested and works perfectly
|
||||
; for gmail (please be aware that you will have to change your
|
||||
; gmail security settings in case you plan to use gmail)
|
||||
; We use "CMail" here because the builtin mail funtions (PureBasic)
|
||||
; are having problems with modern starttls(ssl/tls) communication
|
||||
;
|
||||
|
||||
; shall we send a mail ?
|
||||
MailReport = no
|
||||
|
||||
; maildebugging ? (yes/no)
|
||||
MailDebug = no
|
||||
|
||||
; mail sender...
|
||||
; address formt can be:
|
||||
; john.doe@domain.com
|
||||
; or "<john.doe@domain.com>"
|
||||
; or "john doe <john.doe@domain.com>"
|
||||
; HINT: some mail providers do not accept fictional sender addresses!
|
||||
MailFrom = "MyBackup <john.doe@domain.com>"
|
||||
|
||||
; mail recipient...
|
||||
MailTo = backup@example.com
|
||||
|
||||
; address of SMTP server (TLS/SSL only !)
|
||||
MailServer = smtp.gmail.com
|
||||
|
||||
; port of SMTP server (in most cases it's 465 or 587)
|
||||
MailPort = 465
|
||||
|
||||
; user for sending mail
|
||||
MailUser = example@gmail.com
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
; LICENSE : MIT License
|
||||
; AUTHOR : Michael H.G. Schmidt
|
||||
; EMAIL : michael@schmidt2.de
|
||||
; DATE : 20210530
|
||||
; DATE : 20211003
|
||||
; ------------------------------------------------------------
|
||||
;
|
||||
; This tool creates an image backups of windows machines,
|
||||
@ -29,7 +29,7 @@ EnableGraphicalConsole(0)
|
||||
|
||||
Dim filelist$(0)
|
||||
|
||||
Global VERSION$="V1.05"
|
||||
Global VERSION$="V1.06"
|
||||
Global installme = 0
|
||||
Global updatesched = 0
|
||||
Global dryrun = 0
|
||||
@ -127,9 +127,10 @@ HistLog$ = InstallTo$ + "\" + HistLog$
|
||||
|
||||
PreferenceGroup("mail")
|
||||
Global MailReport$ = Trim(LCase(ReadPreferenceString("MailReport","no")))
|
||||
Global MailDebug$ = Trim(ReadPreferenceString("MailDebug","no"))
|
||||
Global MailFrom$ = Trim(ReadPreferenceString("MailFrom",""))
|
||||
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",""))
|
||||
|
||||
@ -204,30 +205,41 @@ Procedure IsAdmin()
|
||||
ProcedureReturn(system("reg.exe ADD HKLM /F >nul 2>&1"))
|
||||
EndProcedure
|
||||
|
||||
Procedure LogSend(subject$, filename$)
|
||||
InitNetwork()
|
||||
Protected e = 0
|
||||
Protected MailText$ = ""
|
||||
|
||||
If CreateMail(0, "system@" + hostname$ , subject$)
|
||||
AddMailRecipient(0, MailTo$, #PB_Mail_To)
|
||||
LogMe("INFO: MailServer = " + Mailserver$)
|
||||
If ReadFile(0, filename$, #PB_File_SharedRead)
|
||||
While Eof(0) = 0
|
||||
MailText$ + ReadString(0) + Chr($0d) + Chr($0a)
|
||||
Wend
|
||||
CloseFile(0)
|
||||
SetMailBody(0, MailText$)
|
||||
EndIf
|
||||
|
||||
; send mails ALWAYS with SSL...
|
||||
e = SendMail(0, MailServer$, MailPort, #PB_Mail_UseSSL, MailUser$, MailPass$)
|
||||
Procedure LogSend(subject$)
|
||||
Protected MailCommand$ = BinPath$ + "\cmail.exe"
|
||||
|
||||
; CMail found ?
|
||||
If ( FileSize ( MailCommand$ ) < 0 )
|
||||
LogMe("ERROR: [ " + MailCommand$ + " ] NOT found.")
|
||||
ProcedureReturn false
|
||||
EndIf
|
||||
|
||||
ProcedureReturn e
|
||||
; use debug mode ?
|
||||
If (MailDebug$ = "yes" )
|
||||
MailCommand$ + " -d"
|
||||
EndIf
|
||||
|
||||
; send mails ALWAYS with STARTTLS...
|
||||
MailCommand$ + " -starttls -host"
|
||||
MailCommand$ + ":" + MailUser$
|
||||
MailCommand$ + ":" + Chr(34) + MailPass$ + Chr(34)
|
||||
MailCommand$ + "@" + MailServer$
|
||||
MailCommand$ + " -from:" + MailFrom$
|
||||
MailCommand$ + " -to:" + MailTo$
|
||||
MailCommand$ + " -subject:" + Chr(34) + subject$ + Chr(34)
|
||||
MailCommand$ + " -body-file:" + LogFile$
|
||||
|
||||
; show full command in debug mode ...
|
||||
If (MailDebug$ = "yes" )
|
||||
Print(MailCommand$ + Chr($0d) + Chr($0a))
|
||||
EndIf
|
||||
|
||||
dummy=system(MailCommand$)
|
||||
ProcedureReturn true
|
||||
|
||||
EndProcedure
|
||||
|
||||
Procedure EndProg(err)
|
||||
Procedure EndProg(err)
|
||||
Protected s$ = ""
|
||||
|
||||
If ( err = 0 )
|
||||
@ -236,22 +248,22 @@ Procedure EndProg(err)
|
||||
Else
|
||||
LogMe("ERROR: END of BACKUP with result FAILED !")
|
||||
s$ = "BACKUP report - { ERROR ! } @" + hostname$
|
||||
EndIf
|
||||
|
||||
; write return code of last command (snapshot.exe) to logfile
|
||||
LogMe("return=" + err)
|
||||
EndIf
|
||||
|
||||
; send a report via mail ?
|
||||
If ( MailReport$ = "yes" )
|
||||
LogMe("INFO: sending mail to: " + MailTo$)
|
||||
If ( LogSend(s$, Logfile$) )
|
||||
LogMe("INFO: mail sent")
|
||||
Else
|
||||
LogMe("FATAL: could not send backup report via email...")
|
||||
LogMeRaw(" please inform your Administrator !")
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
; write final return code to logfile ...
|
||||
LogMe("return=" + err)
|
||||
|
||||
; finally: send it!
|
||||
If ( MailReport$ = "yes" )
|
||||
LogSend(s$)
|
||||
EndIf
|
||||
|
||||
; adding actual logfile to histlog...
|
||||
If ReadFile(0, Logfile$, #PB_File_SharedRead)
|
||||
While Eof(0) = 0
|
||||
@ -559,8 +571,8 @@ EndProg(e)
|
||||
|
||||
; IDE Options = PureBasic 5.73 LTS (Windows - x64)
|
||||
; ExecutableFormat = Console
|
||||
; CursorPosition = 103
|
||||
; FirstLine = 99
|
||||
; CursorPosition = 236
|
||||
; FirstLine = 214
|
||||
; Folding = --
|
||||
; EnableXP
|
||||
; Executable = snapcontrol.exe
|
||||
|
Loading…
Reference in New Issue
Block a user