diff --git a/snapcontrol.exe b/snapcontrol.exe index 15c9978..145605b 100644 Binary files a/snapcontrol.exe and b/snapcontrol.exe differ diff --git a/snapcontrol.ini b/snapcontrol.ini index 5db79a1..da0d617 100644 --- a/snapcontrol.ini +++ b/snapcontrol.ini @@ -80,6 +80,9 @@ EjectMedia = yes ; should we ask for a shutdown after backup ? (yes/no) AskForShutdown = yes +; should we force a shutdown after the backup run? +; user will NOT be asked for consent! (useful for schedule mode "TIME" and silent mode) +ForcedShutdown = no [LOGGING] diff --git a/snapcontrol.pb b/snapcontrol.pb index 859c761..44379b7 100644 --- a/snapcontrol.pb +++ b/snapcontrol.pb @@ -7,7 +7,7 @@ ; LICENSE : MIT License ; AUTHOR : Michael H.G. Schmidt ; EMAIL : michael@schmidt2.de -; DATE : 20230312 +; DATE : 20230319 ; ------------------------------------------------------------ ; ; This tool creates an image backups of windows machines, @@ -19,7 +19,6 @@ ; Released under the MIT license. ; - ; ; INIT (set vars, read args, read inifile etc. pp.) ; @@ -29,7 +28,7 @@ EnableGraphicalConsole(0) Dim filelist$(0) -Global VERSION$="V1.10" +Global VERSION$="V1.11" Global updatesched = 0 Global dryrun = 0 Global silentmode = 0 @@ -39,7 +38,9 @@ Global month$ = FormatDate("%mm", Date()) Global day$ = FormatDate("%dd", Date()) Global DriveSnapshotVersionOk = 0 Global DoShutdown = 0 -Global Shutdowncommand$ = "shutdown /s /f" + +; Timeout for shutodwn is 2 minutes ... +Global Shutdowncommand$ = "shutdown /s /t 120 /d p:0:0" ; valid versions for Drive Snapshot we support ... NewList DriveSnapshotVersion$() @@ -53,7 +54,7 @@ NewList DriveSnapshotVersion$() DriveSnapshotVersion$() = "V1.48" Procedure Usage() - PrintN ("usage: snapcontrol.exe [ /S | /I | /V> | /D | /? ]") + PrintN ("usage: snapcontrol.exe [ /S | /I | /V | /D | /? ]") PrintN (" /S = silent mode (no user interaction!)") PrintN (" /I = install/update scheduler job") PrintN (" /V = show version") @@ -114,6 +115,7 @@ Global EncryptPW$ = Trim(ReadPreferenceString("EncryptPW","")) Global LimitIO$ = Trim(ReadPreferenceString("LimitIO","")) Global EjectMedia$ = Trim(LCase(ReadPreferenceString("EjectMedia","yes"))) Global AskForShutdown$ = Trim(LCase(ReadPreferenceString("AskForShutdown","no"))) +Global ForcedShutdown$ = Trim(LCase(ReadPreferenceString("ForcedShutdown","no"))) PreferenceGroup("logging") Global LogDir$ = Trim(ReadPreferenceString("LogDir","C:")) @@ -345,9 +347,7 @@ If ( FtpBackup$ = "yes" ) TargetPath$ = "ftp://" + TargetUser$ + "@" + FtpServer$ + TargetPath$ EndIf - -; SILENT mode. -; NO questions! +; SILENT mode <> 0 => NO questions! If ( silentmode = 0 ) ; ; ASK the user for permission to start ... @@ -368,13 +368,24 @@ If ( silentmode = 0 ) ; ; ASK the user for a shutdown ... ; - Result$ = InputRequester("SnapControl", - "SHUTDOWN system after backup?" + Chr(13) + - " (type 'yes' or 'no')", "no") + + If ForcedShutdown$ <> "yes" And AskForShutdown$ = "yes" + Result$ = InputRequester("SnapControl", + "SHUTDOWN system after backup?" + Chr(13) + + " (type 'yes' or 'no')", "no") - If LCase(Result$) = "yes" - DoShutdown = 1 + If LCase(Result$) = "yes" + DoShutdown = 1 + EndIf EndIf + +Else + + ; silent mode = true AND the admin has requested a forced shutdown ... + If ForcedShutdown$ = "yes" + DoShutdown = 1 + EndIf + EndIf @@ -555,7 +566,7 @@ EndProg(e) ; IDE Options = PureBasic 5.73 LTS (Windows - x64) ; ExecutableFormat = Console -; CursorPosition = 29 +; CursorPosition = 20 ; Folding = -- ; EnableXP ; Executable = snapcontrol.exe