determine a display used by gnome-session
Staszek Hodur
staho at os.pl
Fri Dec 30 19:44:05 UTC 2011
Hi all,
I am trying to write a simple script to control the amount
of time my kids are spending at the computer. Fortunately,
there are no Windows, no Gates etc. :-)
The script is supposed to run in cron. If the time is up,
the script will display a message and close the session. I
can get all the X sessions and all the Gnome session, say:
# ps -fe
...
root 2448 952 0 Dec26 tty7 00:48:16 /usr/bin/X
:0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
staho 2555 952 0 Dec26 ? 00:00:00
/usr/bin/gnome-session --session=ubuntu
root 6529 952 1 18:27 tty8 00:01:25 /usr/bin/X
:1 -auth /var/run/lightdm/root/:1 -nolisten tcp vt8 -novtswitch
nadzia 6640 952 0 18:27 ? 00:00:00
/usr/bin/gnome-session --session=ubuntu
...
To display a message I do:
# su staho -c 'zenity --info --display=:0'
# su nadzia -c 'zenity --info --display=:1'
as zenity cannot open display if run by an incorrect user
(not even for root -- why?).
The problem is there is no visible link between X and Gnome.
I mean, one can compare the dates and times, but using it
looks ugly and unsure.
So, my question is: how to determine which gnome-session
process is connected to which display?
Ekhm, "press alt-ctrl-t and type echo $DISPLAY" would not be
the answer the Tiggers like best. ;-)
Happy New Year!
__
Stanislas Hodur
------
Tanie domeny - http://www.adresik.pl
More information about the Ubuntu-devel-discuss
mailing list