Hi list,<div><br></div><div>I would to detect if any user is directly connected (console) on my Linux servers (Debian, CentOS).</div><div>I've created this bash simply bash script :</div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">

<div><div>#!/bin/bash</div></div><div><div><br></div></div><div><div>WHO=`which who`</div></div><div><div>GREP=`which grep`</div></div><div><div>WC=`which wc`</div></div><div><div><br></div></div><div><div>RESULT=`$WHO | $GREP tty | $WC -l`</div>

</div><div><div><br></div></div><div><div>if [ $RESULT -ne 0 ]</div></div><div><div>then</div></div><div><div>  echo $RESULT "utilisateur(s) connecte(s) en console"</div></div><div><div>  exit 1</div></div><div>

<div>else</div></div><div><div>  echo "OK"</div></div><div><div>  exit 0</div></div><div><div>fi</div></div><div><br></div></blockquote>It works fine, but I prefer to use an other method, most lighter than the check_by_ssh.<div>

Do you know an other way to do that, via SNMP for exemple.</div><div><br></div><div>Regards</div>