Advertisement
sorahx0

Untitled

May 29th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.67 KB | None | 0 0
  1. #!/bin/bash
  2. database="/root/usuarios.db"
  3. echo $$ > /tmp/kids
  4. while true
  5. do
  6. tput setaf 7 ; tput setab 1 ; tput bold ; printf '%28s%s%-18s\n' "SSH Monitor"
  7. tput setaf 7 ; tput setab 1 ; printf '  %-30s%s\n' "Usuário" "Conexão/Limite " ; echo "" ; tput sgr0
  8.     while read usline
  9.     do
  10.         user="$(echo $usline | cut -d' ' -f1)"
  11.         s2ssh="$(echo $usline | cut -d' ' -f2)"
  12.         if [ -z "$user" ] ; then
  13.             echo "" > /dev/null
  14.         else
  15.             ps x | grep [[:space:]]$user[[:space:]] | grep -v grep | grep -v pts > /tmp/tmp8
  16.             s1ssh="$(cat /tmp/tmp8 | wc -l)"
  17.             tput setaf 3 ; tput bold ; printf '  %-35s%s\n' $user $s1ssh/$s2ssh; tput sgr0
  18.         fi
  19.     done < "$database"
  20.     echo ""
  21.     exit 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement