Hi,
Ive written a script to take a date parameter that has to look like 03/12/2009 which I have done in test properties. I type %mm%/%dd%/%yyyy% and it my new test works fine.
I decided to test for the previous day and tried to change the Param to %mm%/%dd[-1d]%/%yyyy% and the test fails. Further investigation shows me that this macro is being interpreted as 03/%dd[-1d]%/2009
This looks like a bug to me but perhaps I am missing something.
I am using HostMonitor 7.78 on Windows Server 2003. The test is a window batch script
**********************************
@echo off
Find "%1" "c:\program files\3x backup\log\*err.csv" > c:\scripts\result.out
If ErrorLevel 1 GoTo FALSE
:TRUE
Find "COMPLETE" c:\scripts\result.out
If ErrorLevel 1 GoTo OTHER
If ErrorLevel 0 echo ScriptRes:Ok:%1 Baskup ran successfully
GoTo EXIT
:FALSE
Echo ScriptRes:Bad:%1 Backup did not run
GoTo EXIT
:OTHER
Echo ScriptRes:Bad:%1 Backup Failed
GoTo EXIT
:EXIT
Problem with Date Macro
Quote from the manual
===============
When you setup "Folder/File Size", "File/Folder Availability", "Count Files", "Text Log" or "Compare Files" tests you can set "Translate macros" option and use special macro variables in the file name:
===============
As I understand you are using Shell Script test method. That's why such expression does not work.
Its not a bug.
Perhaps you may start test at the same day backup procedure was performed?
Regards
Alex
===============
When you setup "Folder/File Size", "File/Folder Availability", "Count Files", "Text Log" or "Compare Files" tests you can set "Translate macros" option and use special macro variables in the file name:
===============
As I understand you are using Shell Script test method. That's why such expression does not work.
Its not a bug.
Perhaps you may start test at the same day backup procedure was performed?
Regards
Alex
llinskey,
If you've written this as a shell script why don't you simply provide a second parameter for the offset. -1 for previous day, -7 for a week prior, etc.?
If you really want to jazz it up use -1d, -1w, -1m, etc., parse the parameter and do the math.
I even have an old commandline batch file that can do the math, and it even accommodates leap year! I had some time on my hands in a previous life and wanted to prove I could do it.
I'll even post it in the Library if it would help you to get the date-math right in your script. Or you can email me (see button below) and I'll send it to you.
If you've written this as a shell script why don't you simply provide a second parameter for the offset. -1 for previous day, -7 for a week prior, etc.?
If you really want to jazz it up use -1d, -1w, -1m, etc., parse the parameter and do the math.

I even have an old commandline batch file that can do the math, and it even accommodates leap year! I had some time on my hands in a previous life and wanted to prove I could do it.

I'll even post it in the Library if it would help you to get the date-math right in your script. Or you can email me (see button below) and I'll send it to you.

I have done some testing on this and it looks like a bug.
Response
Test : compare "HDD.txt" & "3/%d[-1d]%/2009"
Method: file compare
Status : Bad
This test allows me to check log files for specific date information - as opposed to the Text Log test, which assumes the file has always existed.
cheers, Paul
Code: Select all
; ------- Test #01 -------
Method = CompareFiles
;--- Common properties ---
;DestFolder = ELCMHT\!Test\
Title = compare "HDD.txt" & "%m%/%d[-1d]%/%yyyy%"
Disabled = Yes
Comment = alert when DoesntContainString ("HDD.txt" & "%m%/%d[-1d]%/%yyyy%")
RelatedURL =
NamePattern = compare "%object%" & "%object2%"
CmntPattern = alert when %testmode% ("%object%" & "%object2%")
ScheduleMode= Regular
Schedule =
Interval = 600
Alerts = Test Email
ReverseAlert= No
UnknownIsBad= No
WarningIsBad= No
UseCommonLog= Yes
PrivLogMode = Default
CommLogMode = Default
;--- Test specific properties ---
AlertMode = DoesntContainString
MissingCheck= Yes
UseMacros1 = Yes
UseMacros2 = No
File1 = C:\Temp\HDD.txt
String = %m%/%d[-1d]%/%yyyy%
WholeWords = No
CaseSensitive = No
;-----------------------------------------------------------------------------
Test : compare "HDD.txt" & "3/%d[-1d]%/2009"
Method: file compare
Status : Bad
This test allows me to check log files for specific date information - as opposed to the Text Log test, which assumes the file has always existed.
cheers, Paul
Sorry, I do not understand what exactly is the bug?
Did we ever said you may use "date expressions" as test name or comment?
Quote from the manual
===============
When you setup "Folder/File Size", "File/Folder Availability", "Count Files", "Text Log" or "Compare Files" tests you can set "Translate macros" option and use special macro variables in the file name
===============
Regards
Alex
Did we ever said you may use "date expressions" as test name or comment?
Quote from the manual
===============
When you setup "Folder/File Size", "File/Folder Availability", "Count Files", "Text Log" or "Compare Files" tests you can set "Translate macros" option and use special macro variables in the file name
===============
Regards
Alex