IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 27, 2008, 1:26:15 PM (18 years ago)
Author:
jhoblitt
Message:

cleanup option handling and docs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/bin/neb-admin

    r17815 r17817  
    33# Copyright (C) 2005-2008  Joshua Hoblitt
    44#
    5 # $Id: neb-admin,v 1.2 2008-05-27 21:59:53 jhoblitt Exp $
     5# $Id: neb-admin,v 1.3 2008-05-27 23:26:15 jhoblitt Exp $
    66
    77use strict;
     
    1919use Pod::Usage qw( pod2usage );
    2020
    21 my ($db, $dbuser, $dbpass, $server, $limit);
     21my ($db, $dbuser, $dbpass, $pending, $limit);
    2222
    2323$db     = $ENV{'NEB_DB'} unless $db;
    2424$dbuser = $ENV{'NEB_USER'} unless $dbuser;
    2525$dbpass = $ENV{'NEB_PASS'} unless $dbpass;
    26 $server = $ENV{'NEB_SERVER'} unless $server;
    2726
    2827GetOptions(
    29     'db=s'          => \$db,
    30     'user=s'        => \$dbuser,
    31     'pass=s'        => \$dbpass,
    32     'server|s=s'    => \$server,
    33     'limit|l=i'     => \$limit,
     28    'db=s'                  => \$db,
     29    'user=s'                => \$dbuser,
     30    'pass=s'                => \$dbpass,
     31    'pendingreplicate|p'    => \$pending,
     32    'limit|l=i'             => \$limit,
    3433) || pod2usage( 2 );
    3534
    3635pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    37 pod2usage( -msg => "Required options: --server", -exitval => 2 )
    38     unless $server;
    3936pod2usage( -msg => "Required options: --db --user --pass", -exitval => 2 )
    4037    unless $db && $dbuser && $dbpass;
     38pod2usage( -msg => "--limit is meaningless without --pendingreplicate",
     39        -exitval => 2 )
     40    if defined $limit and not defined $pending;
     41pod2usage( -msg => "no operation specified", -exitval => 2 )
     42    unless defined $pending;
    4143
    4244# set default limit to 5
    4345$limit ||= 5;
    44 
    45 my $neb = Nebulous::Client->new(
    46     proxy => "$server",
    47 );
    48 
    49 die "can't connected to Nebulous Server: $server"
    50     unless defined $neb;
    5146
    5247my $dbh = DBI->connect(
     
    157152=head1 NAME
    158153
    159 neb-fsck - check and repair Nebulous volumes
     154neb-admin - perform misc. Nebulous administrative functions
    160155
    161156=head1 SYNOPSIS
    162157
    163     neb-fsck [--db <database>] [--user <username>] [--pass <password>]
    164         [--server <server>]
     158    neb-admin [--db <database>] [--user <username>] [--pass <password>]
     159        [--pendingreplicate] [--limit <n>]
    165160
    166161=head1 DESCRIPTION
     
    170165=over 4
    171166
    172 =item * --server|-s <URL>
    173 
    174 URL of the Nebulous server to connect to.
    175 
    176 Optional if the appropriate environment variable is set.
     167=item * --pendingreplicate|-p
     168
     169Print out a list of nebulous keys that need additional replications created.
     170
     171=item * --limit|-l <n>
     172
     173Limits the number of items return in response to some request (like
     174C<--pendingreplicate>).
     175
     176Optional.  Defaults to 5.  --limit 0 is treated as asking for the default
     177value.
    177178
    178179=item * --db|-d <database>
     
    203204
    204205=over 4
    205 
    206 =item * C<NEB_SERVER>
    207 
    208 Equivalent to --server|-s
    209206
    210207=item * C<NEB_DB>
     
    256253=head1 SEE ALSO
    257254
    258 L<Nebulous::Server>, L<neb-initdb>, L<neb-df>, L<nebdiskd>
     255L<Nebulous::Server>, L<neb-addvol>, L<neb-fsck>, L<neb-initdb>, L<nebdiskd>
    259256
    260257=cut
Note: See TracChangeset for help on using the changeset viewer.