guacamole-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Cantle <p...@cantle.me>
Subject Re: Show logged in users
Date Sat, 28 Jan 2017 22:28:08 GMT
Hi all

This shell script will output the “logged in” usernames. Configure the variables according
to your setup: These are correct for my system running CentOS7.3 / Tomcat 7

Anything useful goes into /var/log/messages in my case

Hope it’s useful to someone.

Paul

-------------------------------------------------------------------------

#!/bin/bash

# Set some variables

# The Guacamole log file location
LOGFILE=/var/log/messages

# The Guacamole process
GUACD=/usr/local/sbin/guacd

# List the quacamole child processes and assign to a variable
PROCLIST=$(ps -eopid,ppid,args | awk -vg=$GUACD '$2!="1" && $3==g{printf ":%s",$1}END{print
":"}')

# Command lists
PS=/bin/ps
SED=/bin/sed
CAT=/bin/cat
GREP=/bin/grep

# Iterate through each line of ${LOGFILE} and match
# the Guacamole process with the logged in user
echo "Logged in users:"
echo "----------------"
${CAT} ${LOGFILE}  | ${SED} -n -e "s/.*guacd\[\([0-9][0-9]*\)\].*/GUACPID=\1/p" -e "s/.*User
\"\(.*\)\" connected to.*/GUACUSER=\1/p" | while read LINE
do
        eval $LINE
        echo $LINE | ${GREP} -q GUACPID && continue
        echo "$PROCLIST" | ${GREP} -q $GUACPID && echo $GUACUSER
done


From: Mike Jumper <mike.jumper@guac-dev.org>
Reply-To: "user@guacamole.incubator.apache.org" <user@guacamole.incubator.apache.org>
Date: Thursday, 26 January 2017 at 18:31
To: "user@guacamole.incubator.apache.org" <user@guacamole.incubator.apache.org>
Subject: Re: Show logged in users

If you're just interested in whether any users are actively connected (and not which users
specifically), another quick way would be to count the active guacd processes.

For N connections, there will be N+1 guacd processes. If no one is connected, only one guacd
process will be running.

- Mike


On Jan 26, 2017 10:18 AM, "Diego Souza" <diego.mesquita.souza@gmail.com<mailto:diego.mesquita.souza@gmail.com>>
wrote:
Hi,

You can search for this tomcat log (catalina.out).

regards,
Diego.



--
View this message in context: http://apache-guacamole-incubating-users.2363388.n4.nabble.com/Show-logged-in-users-tp303p327.html
Sent from the Apache Guacamole (incubating) - Users mailing list archive at Nabble.com.
Mime
View raw message