psql -A -q -h host1 -U user1 -d database1 -p 5439 -c "select count(*) from stv_sessions where user_name = 'usertofind'" -F, -t |
grep "^0$" || send-me-a-mail "we detected usertofind"
In this case, we're not using '-F,' but it would make the output be a CSV, so you could do fancier things here.
In this case I want to check if a user has an active session. You can put it in a cronjob and leave it running for some time.
Yes. there are logs for that .
No hay comentarios:
Publicar un comentario