cancel
Showing results for 
Search instead for 
Did you mean: 

How to List All Active Clients (on a linux master server)

TuxanForLife
Level 3

Here is a single command the dumps all active clients from a Linux Master Sever.

   bppllist -L -allpolicies  | egrep "^Policy Name:|^Active:" | paste - - | awk '$NF~yes { print $3 }' | xargs -i bpplclients {} -noheader 2> /dev/null | awk '{ print $3 }'


It does the following

  1. List details of all policies
  2. Extract only policy name and active status
  3. Put all that info on one line
  4. If the last field of that line is yes, print the third field which is the policy name
  1. This long list of active policies is passed (one at a time) to bpplclients, errors are hidden and only the client name is printed (assuming clients have no spaces in the name)



-- OR --

 

Run this script for a little prettier output of the same thing:
   Sample ::

   ##### DenverWebservers  #####
                              bubbles
                                   nerf
                            billybong

   ##### DenverDatbases  #####
                          spaceman
                                   nerf
                              kooliba


  for POLICY in  ` bppllist -L -allpolicies  | egrep "^Policy Name:|^Active:" | paste - - | awk '$NF~yes { print $3 }'`; do

    echo "####  $POLICY ###"
         bpplclients $POLICY -noheader 2> /dev/null | awk '{ printf "%30s\n", $3 }'
    echo " "
  done

----

 

1 ACCEPTED SOLUTION

Accepted Solutions

TuxanForLife
Level 3

 

It's probably more useful if you sort the output:

bppllist -L -allpolicies  | egrep "^Policy Name:|^Active:" | paste - - | awk '$NF~yes { print $3 }' | xargs -i bpplclients {} -noheader 2> /dev/null | awk '{ print $3 }' | sort -u 

 

 

View solution in original post

2 REPLIES 2

TuxanForLife
Level 3

 

It's probably more useful if you sort the output:

bppllist -L -allpolicies  | egrep "^Policy Name:|^Active:" | paste - - | awk '$NF~yes { print $3 }' | xargs -i bpplclients {} -noheader 2> /dev/null | awk '{ print $3 }' | sort -u 

 

 

noazara
VIP
   VIP   

Its not giving any output