Quando un utente si disconnette, voglio visualizzare una finestra. In questa finestra dovrebbe essere un testo (Si prega di salvare i dati ...). Dopo che l'utente ha premuto OK. Il logout del processo continua. È possibile?
onLogout() (
# that works:
if [ "$USER" != "admin" ] && [ "$USER" != "Administrator" ]; then
rm -Rf ~/Downloads/*
rm -Rf ~/Movies/*
rm -Rf ~/Music/*
rm -Rf ~/Pictures/*
rm -Rf ~/Public/*
rm -Rf ~/Desktop/*
fi
# it doesn't work:
res=$(osascript -e 'tell app "System Events" to display dialog "Please save yout Data!" buttons {"Cancel", "OK"} default button 1 with icon caution with title "Important Information!"' 2>/dev/null)
if [[ $res == *OK* ]]; then
# continue logout?
else
# break logout?
fi
exit
)
trap 'onLogout' SIGINT SIGHUP SIGTERM
while true; do
sleep 86400 &
wait $!
done
