autorun script on login

Joseph E. Sacco, Ph.D. joseph_sacco at comcast.net
Mon May 16 13:41:48 MDT 2005


You can put your cleanup stuff at the end of the .xsession file.  The
trick is to get it to run when you want it to run and not before.

There are many ways to do this.  The basic idea is to have the cleanup
stuff follow something that "blocks" the .xsession script from exiting.
The cleanup stuff will not run until that something finishes. 

Why does this work? 
[From the man page for xdm]

        The  xlogin  widget, which xdm presents, offers the familiar
        login and password prompts.
        
        After the user logs in, xdm runs the Xstartup script as root.
        Then xdm runs the Xsession script as the user. This  system
        session file may do some additional startup and typically runs
        the .xsession script in the user’s home directory. When the
        Xsession script exits, the session is over.
        
        At the end of the session, the Xreset script is run to clean up,
        the X server is reset, and the cycle starts over.

Here is a very trivial example:
[script to launch garnome-2.10.1.1 desktop]

        #!/bin/sh
        echo "Starting GARNOME" >> /home/jsacco/garnome.log
        date >> /home/jsacco/garnome.log
        
        dbus-launch --sh-syntax --exit-with-session /usr/local/bin/garnome-session
        
        echo "Exiting GARNOME" >> /home/jsacco/garnome.log
        date >> /home/jsacco/garnome.log
        
The last two commands will not run until garnome-session terminates.

Since .xsession is a shell script, there are more formal things you can
do to "block" like using the "wait" command to wait for a specified
process to terminate.

Enjoy...

-Joseph

=========================================================================
On Mon, 2005-05-16 at 13:09 -0500, Jonathan Hartje wrote:
> Joseph and Mark,
>     Thanks again. The .xsession did the trick! I read the info Joseph 
> pointed me to; However, I'm now in the same situation but the reverse 
> timing. Is there an equivalent file which gets sourced on logout? I'll 
> need to reset the software on logout so the next user that comes along 
> gets a fresh runtime. I'm half way there.. Thanks.
> 
> Jonathan
> _______________________________________________
> yellowdog-general mailing list
> yellowdog-general at lists.terrasoftsolutions.com
> http://lists.terrasoftsolutions.com/mailman/listinfo/yellowdog-general
> HINT: to Google archives, try  '<keywords> site:terrasoftsolutions.com'
-- 
joseph_sacco [at] comcast [dot] net



More information about the yellowdog-general mailing list