Networker

Re: [Networker] Quickie: Script Help

2002-09-06 12:32:17
Subject: Re: [Networker] Quickie: Script Help
From: "Maarten Boot (CWEU-USERS/CWNL)" <Maarten_Boot AT NL.COMPUWARE DOT COM>
To: NETWORKER AT LISTMAIL.TEMPLE DOT EDU
Date: Fri, 6 Sep 2002 18:27:11 +0200
Nelson , as you can see from this snip of perl code:

nsradmin can do:

. type:NSR group;name:<NAME OF GROUP>
show status
print

then see if the group is idle or running


sub test_running ($)
{
    my $CLIENT = shift;
    my $ret = "UNKNOWN";

    # formulate the query

    my @a = (
        ". type:NSR group;name:tmp_$CLIENT",
        "show status",
        "print",
    );

    # prepare the query

    my $tmpf="/tmp/CLIENT.mk.group.nsr.$$";
    open( TMPF, ">" . $tmpf) || die "FATAL:cannot open: '$tmpf',$!";
    print TMPF join("\n",@a) , "\n";
    close TMPF;


    # run the query

    my $NSRADMIN="/usr/sbin/nsradmin";
    open(IN,"/usr/sbin/nsradmin -i $tmpf |") || die "FATAL: cannot start
NSRADMIN,$!";
    while(<IN>) {
        chop;

        # filter the result

        if( /idle/ )         { $ret = "idle";  last; }
        if( /running/ )    { $ret = "running"; last; }
    }
    close IN;
    unlink $tmpf if ( -e $tmpf);

    return $ret;
}


Nelson Caparroso wrote:
>
> Anyone in the list got a chunk of code that demonstrates how to check if any 
> savegroups are running ?
>
> Thanks!
>
> --
> Note: To sign off this list, send a "signoff" command via email
> to listserv AT listmail.temple DOT edu or visit the list's Web site at
> http://listmail.temple.edu/archives/networker.html where you can
> also view and post messages to the list.
> =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

--
Note: To sign off this list, send a "signoff" command via email
to listserv AT listmail.temple DOT edu or visit the list's Web site at
http://listmail.temple.edu/archives/networker.html where you can
also view and post messages to the list.
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

<Prev in Thread] Current Thread [Next in Thread>