On Tuesday 02 October 2012 11:25:25 Mike Gabriel wrote:
> Hi Helmer,
> 
> On Mo 01 Okt 2012 19:22:44 CEST Helmer Teles wrote:
> > P.S: Also, i couldn't get any script working at *-terminate.d
> 
> This file handles the execution of the X2Go Server extensions:
> http://code.x2go.org/gitweb?p=x2goserver.git;a=blob;f=x2goserver-extensions/
> bin/x2goserver-run-extensions
> 
> In line 36 (regexp in egrep command) you can see that files in the
> extension dirs have to obey to this rule: ,,[0-9]{3}_[[:alnum:]]+''
> 
>   <123>_<scriptname>
> 
> Mike

Hi Mike, hello list.

the problem  happens at least in pre-terminate.d & post-terminate.d, 
nevertheless i've managed to do what i want to do, calling a script instead of 
the kde desktop startkde session.

This is what i'm doing:

these scripts are running okay and doing what i want to accomplish, and it 
will be easy for you to understand what they do.

pre-suspend.d/001_suspend-session.sh
#!/bin/bash

/usr/local/bin/fn_cleanpclocal.sh

sleep 2

exit 0

post-suspend.d/002_suspend-session.sh
#!/bin/bash

/usr/local/bin/fn_cleanprinter.sh

sleep 2

exit 0


pre-resume.d/001_resume-session.sh
#!/bin/bash

lock_screen()
{

SESSIONDP=`x2golistdesktops |cut -d : -f 2`

export DISPLAY=:${SESSIONDP}

/usr/lib/kde4/libexec/kscreenlocker --forcelock --showunlock --blank &

}

lock_screen

sleep 10  && /usr/local/bin/fn_getmounts.sh &

exit 0


So, it goes as this. Every-time a user logins i call screenlock to have the 
user to input his password just to complement the ssh key authentication.
Next i will check if the printer and disk tunnels are mounted and will provide 
the user with a Drive icon to the mount point and provide a printer to that 
user. I do this because sometimes a user when resuming a session in another 
workstation some of the tunnels might not be available or missing like the 
shared drive, so i have to check this stuff at session starting, ending, 
suspending and resuming.

What i have found is that at post-terminate.d & pre-terminate.d the scripts 
don't run. So i have to call a custom desktop instead of KDE that calls start 
kde and at the end of the script i put there the calls to 
/usr/local/bin/fn_cleanpclocal.sh & /usr/local/bin/fn_cleanprinter.sh but 
those scripts are working okay when suspending and resuming session.
I've managed to solve the problem this way, but i think that we have a bug in 
there.


For anyone interested here goes part of the script to check the tunnels.



#!/bin/bash


GetPRINTER()
{

PTUNEL=`x2golistmounts ${MYSESSION} |grep -i spool  | wc -l`
PRINTERNAME="${USER}_Printer"


if [ "$PTUNEL" = "1" ]; then

/usr/sbin/lpadmin -p ${PRINTERNAME} -E -v cups-x2go:/ -u allow:"$USER" -D 
"Impressora Virtual"  -o PageSize=A4

kdialog --passivepopup 'Ligação Com Impressora Local Estabelecida Com Sucesso' 
5

fi

}

GetPCLOCAL()
{

STUNEL=`x2golistmounts ${MYSESSION} |grep -i disk  | wc -l`

if [ "$STUNEL" = "1" ]; then

LINK=`x2golistmounts ${MYSESSION} |grep -i disk  |cut -d '|' -f 2`

rmdir ~/media/rm
rmdir ~/media/cd
rm ~/media
rm ~/mounts.log


mkdir ~/Desktop/PCLOCAL

cat > ~/Desktop/PCLOCAL/.directory << EOF
[Desktop Entry]
Icon=drive-removable-media-usb
Name[es]=
Name[pt]=PCLOCAL
EOF

ln -s $LINK ~/Desktop/PCLOCAL/

kdialog --passivepopup 'Ligação com Drive Local Estabelecida com sucesso' 5

else

rmdir ~/media/rm
rmdir ~/media/cd
rm ~/media
rm ~/mounts.log
rm ~/Desktop/PCLOCAL/$LINK

fi

}


MYSESSION=`x2golistsessions |cut -d '|' -f2`
SESSIONDP=`x2golistdesktops |cut -d : -f 2`
export DISPLAY=:${SESSIONDP}

GetPCLOCAL
GetPRINTER

exit 0

 









-- 


Com os melhores cumprimentos,

Helmer Teles 

http://hteles.wordpress.com

“Sent from My Linux Operating System”


Please don't send me proprietary file formats, use ISO standard ODF instead 
(ISO/IEC 26300)


_______________________________________________
X2Go-Dev mailing list
X2Go-Dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/x2go-dev

Reply via email to