I got it working now. If someone wants it too: This is the interesting part of the script:
~~~ # limit in kbyte LIMIT=1000 uid=$(getent passwd "$PAM_USER" | cut -d ":" -f 3) quota=$(vos examine "user.$uid" -format -noauth) total=$(echo "$quota" | grep maxquota | awk '{print $2}') usage=$(echo "$quota" | grep diskused | awk '{print $2}') if [ $(($total - $usage)) -lt $LIMIT ] then # quota nearly reached echo Sie haben weniger als $LIMIT KByte echo Speicher frei. Bitte melden Sie sich echo unter Windows an und entfernen Sie Daten echo von Laufwerk Z: um sich wieder unter echo Ubuntu anmelden zu können. exit 1 fi exit 0 ~~~ Is called by /etc/pam.d/lightdm: ~~~ auth requisite pam_exec.so stdout type=auth /opt/check_afs_free.sh ~~~ And the second script notifies the user when he is logged in and the free space is nearly reached (mostly the same script): ~~~ uid=$(id -u) quota=$(vos examine "user.$uid" -format -noauth) total=$(echo "$quota" | grep maxquota | awk '{print $2}') usage=$(echo "$quota" | grep diskused | awk '{print $2}') if [ $(($total - $usage)) -lt $LIMIT ] then # quota nearly reached # height doesn't work correct but it's ok # zenity is shorter but makes an extremly wide dialog yad --width=700 \ --height=200 \ --center \ --image="gtk-dialog-warning" \ --button=gtk-ok \ --buttons-layout=center \ --title="Speicher fast voll" \ --text="Sie haben weniger als $LIMIT KByte Speicher frei. Wenn der Speicher voll ist, können Sie sich nicht mehr unter Ubuntu anmelden. Bitte entfernen Sie unnötige Dateien aus Ihrem Persönlichen Ordner." fi exit 0 ~~~ Called after login via /etc/xdg/autostart/notify-afs-free.desktop Thanks for your help! -- Michael Richter Technische Universität Berlin Universitätsbibliothek IT-Service Fasanenstraße 88, 10623 Berlin Telefon: +49 (0)30 314-76310 m.rich...@tu-berlin.de www.ub.tu-berlin.de -----Ursprüngliche Nachricht----- Von: Stephan Wiesand [mailto:stephan.wies...@desy.de] Gesendet: Donnerstag, 2. Februar 2017 14:46 An: openafs-info@openafs.org Cc: Richter, Michael Betreff: Re: [OpenAFS] Check free space on AFS share before login Hmm, it should work in any case. The message can be suppressed with the -noauth option for vos. > On 2 Feb 2017, at 14:42, Richter, Michael <m.rich...@tu-berlin.de> wrote: > > OK, did so. But: running "vos examine" in a shell works. If I put the same > line into a script and call this script on the same shell, it doesn't work > and gives me this error: > > vsu_ClientInit: Could not get afs tokens, running unauthenticated. -- Stephan Wiesand DESY -DV- Platanenallee 6 15738 Zeuthen, Germany _______________________________________________ OpenAFS-info mailing list OpenAFS-info@openafs.org https://lists.openafs.org/mailman/listinfo/openafs-info