#!/usr/bin/perl use strict; use warnings; # Author: David Morris # Version: $Id: vxdgdate,v 1.1 2004/11/05 22:57:11 davey Exp $ # Purpose: Display dates diskgroups created # License: Released under the GNU Public Licence (GPL) # The terms of the GPL are available at: # http://www.gnu.org/licenses/gpl.html use POSIX; my $vxdg = "/usr/sbin/vxdg"; #open(VXDG, "$vxdg -q list |"); # Uncomment this line to enable the real command printf STDERR "%-32s %-15s\n", "Diskgroup", "Date Created"; printf STDERR "-"x49; printf STDERR "\n"; while () { # Comment this line and uncomment the line below #while () { # to allow the real command my $line = $_; if ($line =~ /^NAME/ || /^#/ ) { next } else { my ($name, $state, $id) = split /\s+/, $line, 3; my ($ctime,$pad,$host) = split /\./, $id, 3; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($ctime); my $str = POSIX::strftime("%d/%m/%Y %H:%M", localtime($ctime)); my $createdate = "$str"; chomp($createdate); printf "%-32s %-15s\n", $name, $createdate; } } __DATA__ # vxgd list rootdg enabled 1070014481.1025.popeye dg_oracle enabled 1074093988.1291.popeye dg_testarea enabled 1074094353.1317.popeye dg_galaxy enabled 1074094104.1299.popeye dg_celera1 enabled 1074094452.1365.popeye dg_celera2 enabled 1084094452.1395.popeye dg_celera3 enabled 1094094452.1395.popeye