I want to automatically run a program when a user logs on their account
I know how to use rc.local, but what about automatically running something in the X environment when the user first logs in?
|
Are you wanting this to be an X program or from a console or terminal?
Creating a .bash_login usually works for either way. |
isn't that what .xinitrc is for? I may be misunderstanding your question, but in general when the X window system starts up, it checks for the .xinitrc file in the user's home directory. It will then execute what is in that. For instance, I have this:
Code:
xscreensaver & -- the dudeman |
I think we're on the same page, linuxluser, but I don't see that hidden file in my home directory. What next?
|
Missing .xinitrc
I have the same problem, I never had a .xinitrc file in my home directory. I added one to run some commands to remap my mouse wheel so it will scroll properly, but the .xinitrc file never gets parsed (as far as I can tell). The .xinitrc file is shown below:
#!/bin/sh # (c) 2000-2002 MandrakeSoft # $Id: xinitrc-xinitrc,v 1.2 2002/09/10 05:53:43 flepied Exp $ # Set a background here because it's not done anymore # in Xsesion for non root users if [ "`whoami`" != root ]; then xsetroot -solid "#21449C" fi # the following was added by CJW 2005-01-24 for wheel mouse support /usr/X11R6/bin/xmodmap -e "pointer = 1 2 3 6 7 4 5" BINARY=$(which imwheel) $BINARY -k -p -b "67" # end addition 2005-01-24 exec /etc/X11/Xsession $* If I run the "/usr/X11R6/bin/xmodmap -e "pointer = 1 2 3 6 7 4 5"" in a shell everything works fine. Note that I'm running Mandrake 9.2 and KDE with a graphical logon screen. If anyone has any thoughts as to why .xinitrc doesn't get parsed, please let me know! thanks, jh |
Quote:
|
If you don't have .xinitrc then you can make it. The man pages (of startx) indicate that when the .xinitrc file exists, the session exits. You need to have everything run in the background except for the last command. That's why I had an ampersand on the end of every line except the last (which loads my window manager). If you don't, you can get a blank screen or a program unexpectantly exiting or something weird like that.
Sorry if I was unclear about that. -- the dudeman |
Graphical login managers (such as xdm, kdm, gdm) will
use the configuration file: ~/.xsession startx uses: ~/.xinitrc Try a mv .xinitrc .xsession Cheers, Tink |
All times are GMT -5. The time now is 05:18 PM. |