#!/bin/bash

echo $(hostname) in data $(date) >> $HOME/.client-logins.log
HOST=$(hostname)

# Controlla se l'utente è già loggato su un altro host
if grep -v "^$HOST " ~/.client-logins.log; then

    OTHER_HOST=$(grep -v "^$HOST " ~/.client-logins.log)

    yad --info --center --width 1000 --height 400 --fixed  --title "Avviso login" --text-align=center \
--text "<span font='18'><b> \nAttenzione! </b>\n\nSei già loggato su:\n\n$OTHER_HOST \
\n\n  Accedere appena possibile ai PC sopra elencati ed uscire poi dalla sessione.  \n\n</span>"
fi

