how to make cron run gaim under my X session?

Mikkel L. Ellertson mikkel at infinity-ltd.com
Tue Jul 17 14:07:07 UTC 2007


Valent Turkovic wrote:
> Hi, I use gnome-schedule as a gui for cron but I can't make it start
> gaim under my username and to get a gui.
> I can start some scripts and cli programs without any problems but how
> do I start a gui application and under my user not root account.
> 
> Thank you.
> 
I believe the problem is that you can not connect to the X server
because XAUTHORITY is not set in the cron job environment.
XAUTHORITY normally points to a file that contains the "keys"
necessary to connect to the X server. If you are using gdm to handle
GUI logins, the file will be in /tmp and be .gdm<something> owned by
the user logged into X and only accessable by the owner. (and root...)

There are a couple of ways around this. One is to turn off some of
the X security. This can be done using the xhost command. Without
knowing your setup, I can not say what form of the xhost command
would be best. You should probably read the xhost man page.

You could also write a script that looks for the XAUTHORITY file in
/tmp, sets XAUTHORITY to point to that file, and starts gaim. You
will want to be sure that the file is owned by your user, to make
sure you have the correct one.

Depending on what you are trying to do, there may be better ways of
doing it besides using a cron job. One way would be to add a job
that runs when you log into the GUI or run startx from a cli login
that uses the at command to launch gaim at a specific time. There
are also X programs that will launch a program at a specific time.
(You will have to do a search - I don't remember the names right
now.) The advantage here is that you will not be trying to launch
gaim if you are not logged in.

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20070717/5ce9afc6/attachment-0001.sig>


More information about the fedora-list mailing list