How do you script the current time ?

Greigr

Newcomer
Joined
May 8, 2003
Messages
1
Reaction score
0
Points
0
I have an admin script for my backup storage pools that recreates itself if sessions still exist (see below) but I don't want to recreate it after 7pm, does anyone know how to do this ??



p.s. you may find this useful ...



/* -----------------------------------------*/

/* Script Name: BKUP_STG */

/* Description: Backup the storage pools */

/* If there are any active node sessions, */

/* do the TAPEPOOL_CACHE backup but */

/* reschedule the TAPEPOOL backup to run in */

/* 15 minutes. */

/* When it re-runs there should not be any */

/* TAPEPOOL_CACHE files left to backup so */

/* the TAPEPOOL will start it's backup or, **

/* reschedule itself again */

/* -----------------------------------------*/

/* Example1: run bkup_stg */

/* -----------------------------------------*/

ba stg TAPEPOOL_CACHE COPYPOOL maxpr=1 wait=no

ba stg TAPEPOOL_CACHE2 COPYPOOL maxpr=1 wait=yes

select * from sessions where -

upper(session_type)='NODE'

if (rc_ok) goto reschedule

ba stg TAPEPOOL COPYPOOL maxpr=1 wait=no

ba stg TAPEPOOL2 COPYPOOL maxpr=1 wait=yes

exit

reschedule:

del sch retrybkup type=a

def sch retrybkup t=a cmd="run bkup_stg" active=yes -

startt=NOW+0:15 peru=O
 
You can write a dummy message in the activity log with the command : issue message .... and after you get the hour with a select command.



issue message I "MY_MESSAGE"

select 'x' from actlog -

where message='ANR1496I MY_MESSAGE' -

and substr(cast(date_time as char(30)),12,2) > '07'

if (ok) exit
 
You can also issue a SHOW TIME command and parse time from that. The output looks like this:

tsm: SERVER1>show time



Current Date and Time on the Server

----------------------------------------

06/07/03 21:13:42

UTC (GMT) Date/Time is: 06/08/03 02:13:42

Last Noted Date/Time is: 06/07/03 20:23:28



tsm: SERVER1>
 
It's easier than the other replies you received.



select ' ' as "Time is after 7 pm" from status where hour(current_time)>19

if (rc_ok) exit
 
Back
Top