how to make cron run gaim under my X session?

Valent Turkovic valent.turkovic at gmail.com
Wed Jul 18 15:29:44 UTC 2007


On 7/17/07, Mikkel L. Ellertson <mikkel at infinity-ltd.com> wrote:
> 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!
>
>
> --
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
>
>

$ cat start
#!/bin/bash
#
gaim


at -f start 17:27


here is my log from at -c

$ at -c 21
#!/bin/sh
# atrun uid=500 gid=500
# mail  valentt 0
umask 2
SSH_AGENT_PID=3061; export SSH_AGENT_PID
HOSTNAME=fedora; export HOSTNAME
DESKTOP_STARTUP_ID=; export DESKTOP_STARTUP_ID
SHELL=/bin/bash; export SHELL
HISTSIZE=1000; export HISTSIZE
KDE_NO_IPV6=1; export KDE_NO_IPV6
PERL5LIB=/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi:/usr/lib/perl5/site_perl/5.8.8;
export PERL5LIB
GTK_RC_FILES=/etc/gtk/gtkrc:/home/valentt/.gtkrc-1.2-gnome2; export GTK_RC_FILES
WINDOWID=111153717; export WINDOWID
USER=valentt; export USER
LS_COLORS=no=00:fi=00:di=00\;34:ln=00\;36:pi=40\;33:so=00\;35:bd=40\;33\;01:cd=40\;33\;01:or=01\;05\;37\;41:mi=01\;05\;37\;41:ex=00\;32:\*.cmd=00\;32:\*.exe=00\;32:\*.com=00\;32:\*.btm=00\;32:\*.bat=00\;32:\*.sh=00\;32:\*.csh=00\;32:\*.tar=00\;31:\*.tgz=00\;31:\*.arj=00\;31:\*.taz=00\;31:\*.lzh=00\;31:\*.zip=00\;31:\*.z=00\;31:\*.Z=00\;31:\*.gz=00\;31:\*.bz2=00\;31:\*.bz=00\;31:\*.tz=00\;31:\*.rpm=00\;31:\*.cpio=00\;31:\*.jpg=00\;35:\*.gif=00\;35:\*.bmp=00\;35:\*.xbm=00\;35:\*.xpm=00\;35:\*.png=00\;35:\*.tif=00\;35:;
export LS_COLORS
GNOME_KEYRING_SOCKET=/tmp/keyring-LeQLeJ/socket; export GNOME_KEYRING_SOCKET
SSH_AUTH_SOCK=/tmp/ssh-JTDIUx2993/agent.2993; export SSH_AUTH_SOCK
KDEDIR=/usr; export KDEDIR
SESSION_MANAGER=local/fedora:/tmp/.ICE-unix/2993; export SESSION_MANAGER
USERNAME=valentt; export USERNAME
PATH=/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/valentt/bin:/sbin;
export PATH
DESKTOP_SESSION=gnome; export DESKTOP_SESSION
MAIL=/var/spool/mail/valentt; export MAIL
GDM_XSERVER_LOCATION=local; export GDM_XSERVER_LOCATION
PWD=/home/valentt; export PWD
INPUTRC=/etc/inputrc; export INPUTRC
XMODIFIERS=@im=none; export XMODIFIERS
LANG=en_US.UTF-8; export LANG
KDE_IS_PRELINKED=1; export KDE_IS_PRELINKED
GDMSESSION=gnome; export GDMSESSION
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass; export SSH_ASKPASS
SHLVL=2; export SHLVL
HOME=/home/valentt; export HOME
GNOME_DESKTOP_SESSION_ID=Default; export GNOME_DESKTOP_SESSION_ID
LOGNAME=valentt; export LOGNAME
CVS_RSH=ssh; export CVS_RSH
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Cxud1Q7RFr,guid=a2f2e4a2f89a88d2d1f6d70046977f1a;
export DBUS_SESSION_BUS_ADDRESS
LESSOPEN=\|/usr/bin/lesspipe.sh\ %s; export LESSOPEN
G_BROKEN_FILENAMES=1; export G_BROKEN_FILENAMES
COLORTERM=gnome-terminal; export COLORTERM
XAUTHORITY=/tmp/.gdmEJJKVT; export XAUTHORITY
OLDPWD=/home/valentt; export OLDPWD
cd /home/valentt || {
         echo 'Execution directory inaccessible' >&2
         exit 1
}
${SHELL:-/bin/sh} << `(dd if=/dev/urandom count=200 bs=1
2>/dev/null|LC_ALL=C tr -d -c '[:alnum:]')`

#!/bin/bash
#
gaim




-- 
http://kernelreloaded.blog385.com/
linux, blog, anime, spirituality, windsurf, wireless
registered as user #367004 with the Linux Counter, http://counter.li.org.
ICQ: 2125241
Skype: valent.turkovic




More information about the fedora-list mailing list