 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
mbenton
Joined: 08 Feb 2010 Posts: 38 Country: United Kingdom |
|
24x7 Multi-Platform 4.3.293 - @T Macro Parameter |
|
Running a trial version of 24x7 Multi-platform 4.3.292 on Red Hat Linux.
Q: Is it possible for the @T macro parameter to output the time in 24-hour clock format ?
I am using @T"yyyymmdd:hhmmss", which produces 20100208:034001" but I would like it to produce 20100208:154001
The User manual does not provide examples of the usage of "hhmmss" in the @T macro.
|
|
Mon Feb 08, 2010 11:42 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
That is a good guess. Using hhmmss should be ok for 12-hour format.. If you need 24-hour format, try HHmmss
|
|
Mon Feb 08, 2010 3:16 pm |
|
 |
mbenton
Joined: 08 Feb 2010 Posts: 38 Country: United Kingdom |
|
|
|
I've tried to use HH, but the following command string;
/bin/sh -c "/scheduler/scripts/testjob1.sh > /scheduler/logs/@T"yyyymmddHHmmss".@V"job_name".log
produces;
20100209HH3900.TESTJOB1.log
and not;
20100209093900.TESTJOB1.log [09:39:00 hrs]
|
|
Tue Feb 09, 2010 5:20 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
Well, your guess was right, my guess was wrong. The undocumented "hhmmss" can be used to obtain time portion of the current date time value, but it returns that in 12-hour format. The solution to that is either moving time calculations to the invoked shell script, or piping the command line to sed or other utility and making it strip all non-digits from the $(time) value; or what could be actually easier, using a simple script type job in 24x7 and in the job concatenating and running the required command line. For example, if you use a JavaScript job, you can call standard JavaScript date time functions to obtain the required time values in printable format then do something like
var time_value = getClockTime();
time_value.replace(/[^0-9]/g, '');
or just get each time particle separately as a number
var hour = now.getHours();
var minute = now.getMinutes();
var second = now.getSeconds();
var monthnumber = now.getMonth();
var monthday = now.getDate();
var year = now.getYear();
|
|
Tue Feb 09, 2010 10:00 am |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|