#!/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='20'><b> \nAttenzione! </b>\n\nSei già loggato su $OTHER_HOST \
	\n\nAccedere appena possibile ai PC sopra elencati ed uscire poi dalla sessione.</span>"
fi

