Another possibly interesting way to do it:

tsm> select distinct(date(current_timestamp - 1 day)) from <any table>

-
Cameron Hanover
chano...@umich.edu

When any government, or church for that matter, undertakes to say to its 
subjects, this you may not read, this you must not see, this you are forbidden 
to know, the end result is tyranny and oppression, no matter how holy the 
motive.
--Robert A. Heinlein

> On Apr 10, 2015, at 3:29 PM, Mitchell, Ruth Slovik <rmi...@illinois.edu> 
> wrote:
> 
> This will give you yesterday's date from ksh on AIX:
> 
> YESTERDAY=`TZ=aaa24 date +%Y%m%d`
> echo $YESTERDAY
> 
> (found on www.unix.com)
> 
> --Ruth
> U of Illinois, Urbana
> 
> -----Original Message-----
> From: ADSM: Dist Stor Manager [mailto:ADSM-L@VM.MARIST.EDU] On Behalf Of 
> Rhodes, Richard L.
> Sent: Friday, April 10, 2015 11:22 AM
> To: ADSM-L@VM.MARIST.EDU
> Subject: Re: [ADSM-L] finding possible values for a particular column
> 
> Hmmm . . . Linux . . . We're on AIX and its date doesn't handle that.  Have 
> to see about getting gnu date for aix.
> 
> Thanks!
> 
> Rick
> 
> 
> -----Original Message-----
> From: ADSM: Dist Stor Manager [mailto:ADSM-L@VM.MARIST.EDU] On Behalf Of 
> Hanover, Cameron
> Sent: Friday, April 10, 2015 10:36 AM
> To: ADSM-L@VM.MARIST.EDU
> Subject: Re: finding possible values for a particular column
> 
> It's just a bash script, so:
> yesterday=`date -d yesterday +%m/%d/%Y`
> today=`date +%m/%d/%Y`
> 
> -
> Cameron Hanover
> chano...@umich.edu
> 
> "They that can give up essential liberty to obtain a little temporary safety 
> deserve neither liberty nor safety." 
> --Benjamin Franklin
> 
>> On Apr 9, 2015, at 3:18 PM, Rhodes, Richard L. <rrho...@firstenergycorp.com> 
>> wrote:
>> 
>> Hi Cameron,
>> 
>> I'd be interested how you get the value for var ${yesterday} in your script? 
>>  (assuming you compute it off of ${today} ?)
>> 
>> I've wanted to derive an earlier date (like the date of a week ago) in a 
>> script a number of times and couldn't come up with a simple way to do it.  
>> 
>> Rick
>> 
>> 
>> -----Original Message-----
>> From: ADSM: Dist Stor Manager [mailto:ADSM-L@VM.MARIST.EDU] On Behalf Of 
>> Hanover, Cameron
>> Sent: Thursday, April 09, 2015 1:15 PM
>> To: ADSM-L@VM.MARIST.EDU
>> Subject: Re: finding possible values for a particular column
>> 
>> Rather than figure out all the possible conditions, I just scripted for the 
>> ones I cared about and warned on the rest:
>> 
>> for STATUS in `tsm_run_command_as_admin $INSTANCE -tab "select status from 
>> events where domain_name like upper('${PREFIX}%') and 
>> scheduled_start>'${yesterday} 09:00' and scheduled_start<'${today} 09:00'"`; 
>> do
>>      if [[ "$STATUS" == Failed* ]]; then
>>              NODESFAILED="YES"
>>      elif [ "$STATUS" = "Missed" ]; then
>>              NODESMISSED="YES"
>>      # Some unknown exception will produce a "WARNING"
>>      elif [ ! "$STATUS" = "Completed" ] && [ ! "$STATUS" = "In Progress" ] 
>> && [ ! "$STATUS" = "Started" ] && [ ! "$STATUS" = "Pending" ]; then
>>              EXCEPTIONFOUND="YES"
>>      fi
>> done
>> …
>> if [ "$NODESFAILED" = "YES" ]; then
>>      SUBJECT="[TSMCLIENT] NODES FAILED: $LABEL Daily Report"
>> elif [ "$NODESMISSED" = "YES" ]; then
>>      SUBJECT="[TSMCLIENT] NODES MISSED: $LABEL Daily Report"
>> elif [ "$EXCEPTIONFOUND" = "YES" ]; then
>>      SUBJECT="[TSMCLIENT] WARNING: $LABEL Daily Report"
>> else
>>      SUBJECT="[TSMCLIENT] $LABEL Daily Report"
>> fi
>> 
>> 
>> Hopefully the variable names are obvious.  Might have been better with 
>> `case`, but this works.
>> 
>> --
>> Cameron Hanover
>> chano...@umich.edu
>> 
>> "A computer once beat me at chess, but it was no match for me at kick 
>> boxing."
>> --Emo Philips
>> 
>>> On Apr 8, 2015, at 2:55 PM, Lee, Gary <g...@bsu.edu> wrote:
>>> 
>>> Is there a list somewhere of the possible values for different columns in 
>>> the tsm database?
>>> 
>>> What I am particularly looking for are all the possible values of the 
>>> status column in the events table.
>>> 
>>> Writing a script to notify backup schedules which have gone amiss.
>>> 
>>> Don't care about restarted, in progress, etc.  just error conditions.
>>> 
>>> Thanks for any pointers.
>> 
>> 
>> -----------------------------------------
>> The information contained in this message is intended only for the personal 
>> and confidential use of the recipient(s) named above. If the reader of this 
>> message is not the intended recipient or an agent responsible for delivering 
>> it to the intended recipient, you are hereby notified that you have received 
>> this document in error and that any review, dissemination, distribution, or 
>> copying of this message is strictly prohibited. If you have received this 
>> communication in error, please notify us immediately, and delete the 
>> original message.
> 
> 
> -----------------------------------------
> The information contained in this message is intended only for the personal 
> and confidential use of the recipient(s) named above. If the reader of this 
> message is not the intended recipient or an agent responsible for delivering 
> it to the intended recipient, you are hereby notified that you have received 
> this document in error and that any review, dissemination, distribution, or 
> copying of this message is strictly prohibited. If you have received this 
> communication in error, please notify us immediately, and delete the original 
> message.

Reply via email to