[OpenAFS] 'vos examine', 'Last update' and date format

Turbo Fredriksson turbo@bayour.com
28 Aug 2003 08:07:11 +0200


>>>>> "Derrick" == Derrick J Brashear <shadow@dementia.org> writes:

    Derrick> On Wed, 27 Aug 2003, Neulinger, Nathan wrote:
    >> It's already there. Might not be in 1.2.x though.
    >> 
    >> infinity(36)>vos e users.nneul -format

    Derrick> it's old, actually, i think it came from ibm. maybe
    Derrick> not.

It's not in 1.2

[papadoc.pts/4]$ vos examine user.turbo -format
vos: Unrecognized or ambiguous switch '-format'; type 'vos help examine' for detailed help


But I managed to solve it with the 'date' format (strangly enough :)
(shell function included for the archive)

----- s n i p -----
# --------------
# FUNCTION: Check if volume have been modified within the last 24 hours
#           Returns 1 if it have, 0 if not
get_vol_mod () {
    # Examine volume - when was volume last modified?
    local last=`vos examine $1 -localauth | grep 'Last Update' | sed 's@.*Update @@'`

    # What's that in UNIX std format (seconds since Jan 1, 1970)?
    local modified=`date -d "$last" +"%s"`

    # What's the current UNIX std time (- 24h)?
    local now=`date +"%s"`
    now=`expr $now - \( 60 \* 60 \* 24 \)`

    if [ $modified -ge $now ]; then
        return 1
    else
        return 0
    fi
}
----- s n i p -----