V1.08
This commit is contained in:
parent
3a3fbce706
commit
9098bc9538
16
README.md
16
README.md
@ -34,7 +34,7 @@ Get it from here: https://www.inveigle.net/cmail/download
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
- Download the latest release and unzip the files
|
- Download the latest release and unzip the files (.exe and .ini file) to some path of your choice
|
||||||
- Open "snapcontrol.ini" with the editor of your choice and set the following variables:
|
- Open "snapcontrol.ini" with the editor of your choice and set the following variables:
|
||||||
- BinPath
|
- BinPath
|
||||||
- TargetPath
|
- TargetPath
|
||||||
@ -49,21 +49,21 @@ Get it from here: https://www.inveigle.net/cmail/download
|
|||||||
snapcontrol.exe /I
|
snapcontrol.exe /I
|
||||||
```
|
```
|
||||||
|
|
||||||
( Snapcontrol copies the config file and itself to the location of the "InstallTo" variable. )
|
Snapcontrol will find "snapcontrol.ini" automagically in the path where snapcontrol.exe was *installed*!
|
||||||
|
|
||||||
That's all. Snapcontrol will be called by the Windows scheduler. See "snapcontrol.ini" for detailed comments on the features.
|
That's all. Snapcontrol will now be called by the Windows scheduler. See "snapcontrol.ini" for detailed comments on the features.
|
||||||
|
|
||||||
|
|
||||||
## USAGE
|
## USAGE
|
||||||
|
|
||||||
```dos
|
```dos
|
||||||
C:\>snapcontrol.exe /?
|
C:\>snapcontrol.exe /?
|
||||||
usage: snapcontrol.exe </I | /U | /D | /V>
|
usage: snapcontrol.exe [ /I | /V> | /D | /? ]
|
||||||
/I = install program and config
|
/I = install/update scheduler job
|
||||||
/U = update scheduler job
|
|
||||||
/D = dry run
|
|
||||||
/V = show version
|
/V = show version
|
||||||
|
/D = dry run
|
||||||
|
/? = help
|
||||||
```
|
```
|
||||||
|
|
||||||
Everytime you change the values in "BackupSched" or "BackupStart" you will have to call snapcontrol.exe with the /U switch.
|
Everytime you change the values in "BackupSched" or "BackupStart" you will have to call snapcontrol.exe with the /I switch.
|
||||||
|
|
||||||
|
BIN
snapcontrol.exe
BIN
snapcontrol.exe
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
; SNAPCONTROL config file.
|
; SNAPCONTROL config file.
|
||||||
; https://github.com/mhgschmidt/snapcontrol
|
; https://gitea.exabyte.systems/WINDOWS/snapcontrol
|
||||||
;
|
;
|
||||||
; This tool creates an image backups of windows machines,
|
; This tool creates an image backups of windows machines,
|
||||||
; it uses the Drive Snapshot tool by Tom Ehlert Software.
|
; it uses the Drive Snapshot tool by Tom Ehlert Software.
|
||||||
@ -13,16 +13,10 @@
|
|||||||
; IMPORTANT: DO NOT USE quotation marks in this INIFILE !
|
; IMPORTANT: DO NOT USE quotation marks in this INIFILE !
|
||||||
;
|
;
|
||||||
|
|
||||||
|
[BACKUP]
|
||||||
[INSTALL]
|
|
||||||
; where to install the exe and the infile ...
|
|
||||||
InstallTo = c:\snapshot
|
|
||||||
|
|
||||||
; path where snapshot.exe and cmail.exe is located ...
|
; path where snapshot.exe and cmail.exe is located ...
|
||||||
BinPath = c:\tools
|
BinPath = c:\tools
|
||||||
|
|
||||||
|
|
||||||
[BACKUP]
|
|
||||||
; target PATH examples:
|
; target PATH examples:
|
||||||
; - "D:\BACKUP" (LOCAL path on drive d:)
|
; - "D:\BACKUP" (LOCAL path on drive d:)
|
||||||
; - "\\example\share" (SMB share on server "example")
|
; - "\\example\share" (SMB share on server "example")
|
||||||
@ -88,8 +82,15 @@ AskForShutdown = yes
|
|||||||
|
|
||||||
|
|
||||||
[LOGGING]
|
[LOGGING]
|
||||||
LogFile = backup.log
|
|
||||||
HistLog = history.log
|
; directory for logfiles
|
||||||
|
LogDir = C:
|
||||||
|
|
||||||
|
; single run logfile
|
||||||
|
LogFile = snapshot-backup.log
|
||||||
|
|
||||||
|
; cumulated logfile
|
||||||
|
HistLog = snapshot-history.log
|
||||||
|
|
||||||
|
|
||||||
[MAIL]
|
[MAIL]
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
; LICENSE : MIT License
|
; LICENSE : MIT License
|
||||||
; AUTHOR : Michael H.G. Schmidt
|
; AUTHOR : Michael H.G. Schmidt
|
||||||
; EMAIL : michael@schmidt2.de
|
; EMAIL : michael@schmidt2.de
|
||||||
; DATE : 20211021
|
; DATE : 20230311
|
||||||
; ------------------------------------------------------------
|
; ------------------------------------------------------------
|
||||||
;
|
;
|
||||||
; This tool creates an image backups of windows machines,
|
; This tool creates an image backups of windows machines,
|
||||||
@ -29,8 +29,7 @@ EnableGraphicalConsole(0)
|
|||||||
|
|
||||||
Dim filelist$(0)
|
Dim filelist$(0)
|
||||||
|
|
||||||
Global VERSION$="V1.07b"
|
Global VERSION$="V1.08"
|
||||||
Global installme = 0
|
|
||||||
Global updatesched = 0
|
Global updatesched = 0
|
||||||
Global dryrun = 0
|
Global dryrun = 0
|
||||||
Global hostname$ = GetEnvironmentVariable("COMPUTERNAME")
|
Global hostname$ = GetEnvironmentVariable("COMPUTERNAME")
|
||||||
@ -53,36 +52,34 @@ NewList DriveSnapshotVersion$()
|
|||||||
DriveSnapshotVersion$() = "V1.48"
|
DriveSnapshotVersion$() = "V1.48"
|
||||||
|
|
||||||
Procedure Usage()
|
Procedure Usage()
|
||||||
PrintN ("usage: snapcontrol.exe </I | /U | /D | /V>")
|
PrintN ("usage: snapcontrol.exe [ /I | /V> | /D | /? ]")
|
||||||
PrintN (" /I = install program and config")
|
PrintN (" /I = install/update scheduler job")
|
||||||
PrintN (" /U = update scheduler job")
|
|
||||||
PrintN (" /D = dry run")
|
|
||||||
PrintN (" /V = show version")
|
PrintN (" /V = show version")
|
||||||
|
PrintN (" /D = dry run")
|
||||||
|
PrintN (" /? = help")
|
||||||
End 99
|
End 99
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
; check commandline...
|
; check commandline...
|
||||||
If ( CountProgramParameters() >1 )
|
If ( CountProgramParameters() > 1 )
|
||||||
Usage()
|
Usage()
|
||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
; set path for inifile ...
|
; install or update job, show version, dry run ...
|
||||||
inifile$ = RTrim(GetPathPart(ProgramFilename()),"\") + "\snapcontrol.ini"
|
|
||||||
|
|
||||||
; install job, update job, show version, dry run ...
|
|
||||||
If ( UCase(ProgramParameter(0)) = "/I" )
|
If ( UCase(ProgramParameter(0)) = "/I" )
|
||||||
installme = 1
|
|
||||||
ElseIf ( UCase(ProgramParameter(0)) = "/U" )
|
|
||||||
updatesched = 1
|
updatesched = 1
|
||||||
ElseIf ( UCase(ProgramParameter(0)) = "/V" )
|
ElseIf ( UCase(ProgramParameter(0)) = "/V" )
|
||||||
PrintN ("Version = " + VERSION$)
|
PrintN ("Version = " + VERSION$)
|
||||||
End 0
|
End 0
|
||||||
ElseIf ( UCase(ProgramParameter(0)) = "/D" )
|
ElseIf ( UCase(ProgramParameter(0)) = "/D" )
|
||||||
dryrun = 1
|
dryrun = 1
|
||||||
ElseIf ( UCase(ProgramParameter(0)) = "/?" )
|
ElseIf ( ProgramParameter(0) = "/?" )
|
||||||
Usage()
|
Usage()
|
||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
|
; set path for inifile ...
|
||||||
|
inifile$ = RTrim(GetPathPart(ProgramFilename()),"\") + "\snapcontrol.ini"
|
||||||
|
|
||||||
; Procedure "RunProgram" aborts after writing approx. 8GB data with snapshot64...
|
; Procedure "RunProgram" aborts after writing approx. 8GB data with snapshot64...
|
||||||
; so we will use native "system" command...
|
; so we will use native "system" command...
|
||||||
ImportC "msvcrt.lib"
|
ImportC "msvcrt.lib"
|
||||||
@ -94,11 +91,8 @@ If (Not OpenPreferences(inifile$))
|
|||||||
End 98
|
End 98
|
||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
PreferenceGroup("install")
|
|
||||||
Global InstallTo$ = Trim(ReadPreferenceString("InstallTo","c:\snapshot"))
|
|
||||||
Global BinPath$ = Trim(ReadPreferenceString("BinPath","c:\tools"))
|
|
||||||
|
|
||||||
PreferenceGroup("backup")
|
PreferenceGroup("backup")
|
||||||
|
Global BinPath$ = Trim(ReadPreferenceString("BinPath","c:\tools"))
|
||||||
Global TargetPath$ = Trim(ReadPreferenceString("TargetPath","\\server\share"))
|
Global TargetPath$ = Trim(ReadPreferenceString("TargetPath","\\server\share"))
|
||||||
Global FtpBackup$ = Trim(ReadPreferenceString("FtpBackup","no"))
|
Global FtpBackup$ = Trim(ReadPreferenceString("FtpBackup","no"))
|
||||||
Global FtpServer$ = Trim(LCase(ReadPreferenceString("FtpServer","none")))
|
Global FtpServer$ = Trim(LCase(ReadPreferenceString("FtpServer","none")))
|
||||||
@ -118,12 +112,13 @@ Global EjectMedia$ = Trim(LCase(ReadPreferenceString("EjectMedia","yes")))
|
|||||||
Global AskForShutdown$ = Trim(LCase(ReadPreferenceString("AskForShutdown","no")))
|
Global AskForShutdown$ = Trim(LCase(ReadPreferenceString("AskForShutdown","no")))
|
||||||
|
|
||||||
PreferenceGroup("logging")
|
PreferenceGroup("logging")
|
||||||
Global LogFile$ = Trim(ReadPreferenceString("LogFile","backup.log"))
|
Global LogDir$ = Trim(ReadPreferenceString("LogDir","C:"))
|
||||||
Global HistLog$ = Trim(ReadPreferenceString("HistLog","history.log"))
|
Global LogFile$ = Trim(ReadPreferenceString("LogFile","snapshot-backup.log"))
|
||||||
|
Global HistLog$ = Trim(ReadPreferenceString("HistoryLog","snapshot-history.log"))
|
||||||
|
|
||||||
; add PATH to logfiles ...
|
; add PATH to logfiles ...
|
||||||
LogFile$ = InstallTo$ + "\" + LogFile$
|
LogFile$ = LogDir$ + "\" + LogFile$
|
||||||
HistLog$ = InstallTo$ + "\" + HistLog$
|
HistLog$ = LogDir$ + "\" + HistLog$
|
||||||
|
|
||||||
PreferenceGroup("mail")
|
PreferenceGroup("mail")
|
||||||
Global MailReport$ = Trim(LCase(ReadPreferenceString("MailReport","no")))
|
Global MailReport$ = Trim(LCase(ReadPreferenceString("MailReport","no")))
|
||||||
@ -306,33 +301,7 @@ EndProcedure
|
|||||||
; MAIN
|
; MAIN
|
||||||
;
|
;
|
||||||
|
|
||||||
; installation requested ?
|
; install or update for jobscheduler requested ?
|
||||||
If ( installme = 1 )
|
|
||||||
|
|
||||||
; delete old logfiles ...
|
|
||||||
LogMe("INFO: deleting old logfiles ...")
|
|
||||||
dummy = system("del /F /Q " + LogFile$ + " 2>nul")
|
|
||||||
dummy = system("del /F /Q " + HistLog$ + " 2>nul")
|
|
||||||
|
|
||||||
; create directory ...
|
|
||||||
LogMe("INFO: creating directory [ " + InstallTo$ + " ] ...")
|
|
||||||
dummy = system("mkdir " + InstallTo$ + " >nul 2>&1")
|
|
||||||
|
|
||||||
; copy binary and inifile ...
|
|
||||||
LogMe("INFO: copy binary and inifile to folder [ " + InstallTo$ + " ] ...")
|
|
||||||
dummy = system("copy /Y " + inifile$ + " " + InstallTo$ + " 2>nul")
|
|
||||||
dummy = system("copy /Y " + ProgramFilename() + " " + InstallTo$ + " 2>nul")
|
|
||||||
|
|
||||||
; update jobscheduler (selfcall) ...
|
|
||||||
dummy = system(InstallTo$ + "\snapcontrol.exe /U 2>nul")
|
|
||||||
|
|
||||||
ClosePreferences()
|
|
||||||
CloseConsole()
|
|
||||||
End
|
|
||||||
|
|
||||||
EndIf
|
|
||||||
|
|
||||||
; update for jobscheduler requested ?
|
|
||||||
If ( updatesched = 1 )
|
If ( updatesched = 1 )
|
||||||
username$ = GetEnvironmentVariable("USERNAME")
|
username$ = GetEnvironmentVariable("USERNAME")
|
||||||
|
|
||||||
@ -403,6 +372,7 @@ dummy = DeleteFile(LogFile$, #PB_FileSystem_Force)
|
|||||||
LogMe("============== starting BACKUP ==============")
|
LogMe("============== starting BACKUP ==============")
|
||||||
LogMe("snapcontrol.exe version = [ " + VERSION$ + " ]")
|
LogMe("snapcontrol.exe version = [ " + VERSION$ + " ]")
|
||||||
LogMe(" snapshot.exe version = [ " + DriveSnapshotVersion$() + " ]")
|
LogMe(" snapshot.exe version = [ " + DriveSnapshotVersion$() + " ]")
|
||||||
|
LogMe(" INIFILE = [ " + inifile$ + " ]")
|
||||||
|
|
||||||
If ( dryrun = 1 )
|
If ( dryrun = 1 )
|
||||||
LogMe("DRYRUN - (simulating a backup run) !!!")
|
LogMe("DRYRUN - (simulating a backup run) !!!")
|
||||||
@ -438,7 +408,7 @@ If ( Encrypt$ = "dynamic" )
|
|||||||
LogMe("WARNING: ENCRYPTED backup requested and DYNAMIC password was requested !")
|
LogMe("WARNING: ENCRYPTED backup requested and DYNAMIC password was requested !")
|
||||||
LogMeRaw(" Generated password is: --->>> " + EncryptPW$ + " <<<---")
|
LogMeRaw(" Generated password is: --->>> " + EncryptPW$ + " <<<---")
|
||||||
LogMe("INFO: writing password to inifile...")
|
LogMe("INFO: writing password to inifile...")
|
||||||
PreferenceGroup("Global")
|
PreferenceGroup("backup")
|
||||||
dummy = WritePreferenceString("EncryptPW", EncryptPW$)
|
dummy = WritePreferenceString("EncryptPW", EncryptPW$)
|
||||||
Else
|
Else
|
||||||
LogMe("WARNING: ENCRYPTED backup requested. Using DYNAMIC password in inifile !")
|
LogMe("WARNING: ENCRYPTED backup requested. Using DYNAMIC password in inifile !")
|
||||||
@ -572,8 +542,7 @@ EndProg(e)
|
|||||||
|
|
||||||
; IDE Options = PureBasic 5.73 LTS (Windows - x64)
|
; IDE Options = PureBasic 5.73 LTS (Windows - x64)
|
||||||
; ExecutableFormat = Console
|
; ExecutableFormat = Console
|
||||||
; CursorPosition = 555
|
; CursorPosition = 31
|
||||||
; FirstLine = 519
|
|
||||||
; Folding = --
|
; Folding = --
|
||||||
; EnableXP
|
; EnableXP
|
||||||
; Executable = snapcontrol.exe
|
; Executable = snapcontrol.exe
|
||||||
|
Loading…
Reference in New Issue
Block a user