[Serusers] 2 quick questions

Klaus Darilion klaus.mailinglists at pernau.at
Thu Mar 30 12:23:07 CEST 2006


Nick Hoffman wrote:
> Hey guys, I just have 2 quick questions:
> 
> If ser is running and dealing with 500+ registered users, would doing a
>     ``serctl ul show USERNAME''
> add a significant amount of load the box?

no

> Using serctl, how do you determine if a given user exists within ser? 
> ``serctl ul show USERNAME'' only shows "in-RAM online users", so won't 
> necessarily show an existing, offline user...

There is no explicit way to check this from serctl. It is done insider 
serctl e.g. before adding a new subscriber:

# params: user
# output: false if exists, true otherwise
is_user() {
         set_user $1

         QUERY="select count(*) from $SUB_TABLE \
                 where $SUBSCRIBER_COLUMN='$SERUSER' and 
$REALM_COLUMN='$SERDOMA$
         CNT=`sql_ro_query "$QUERY" | grep -v ERROR | $LAST_LINE`
         if [ "0$CNT" -eq 0 ] ; then
                 false
         else
                 true
         fi
}

Thus you ether check it manually using a SQL query on the database or 
you modify serctl to call the is_user function explict, e.g. with:
serctl find <username>

regards
klaus




More information about the sr-users mailing list