LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-31-2005, 08:39 PM   #1
bad_andy
Member
 
Registered: Aug 2004
Distribution: Mandrake 10.1/Slackware 10.0
Posts: 154

Rep: Reputation: 30
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?
 
Old 01-31-2005, 08:45 PM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Are you wanting this to be an X program or from a console or terminal?

Creating a .bash_login usually works for either way.
 
Old 01-31-2005, 08:48 PM   #3
linuxLuser
Member
 
Registered: Jan 2005
Distribution: Gentoo
Posts: 111

Rep: Reputation: 16
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 &
xpenguins -n 36 &
enlighenment
which will execute the xscreensaver (starting it up), then xpenguins (giving me a bunch of crazy penguins running around everywhere ) and then finally starting my window-manager (enlightenment).

-- the dudeman
 
Old 01-31-2005, 08:55 PM   #4
bad_andy
Member
 
Registered: Aug 2004
Distribution: Mandrake 10.1/Slackware 10.0
Posts: 154

Original Poster
Rep: Reputation: 30
I think we're on the same page, linuxluser, but I don't see that hidden file in my home directory. What next?
 
Old 02-01-2005, 12:52 AM   #5
jhcatch22
LQ Newbie
 
Registered: Apr 2004
Location: Manitoba
Distribution: Mandrake 9.2 & 9.1
Posts: 12

Rep: Reputation: 0
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
 
Old 02-01-2005, 12:57 PM   #6
h2gofast
Member
 
Registered: Dec 2002
Distribution: Debian
Posts: 154

Rep: Reputation: 30
Quote:
If I run the "/usr/X11R6/bin/xmodmap -e "pointer = 1 2 3 6 7 4 5"" in a shell everything works fine.
same for me I have to run xmodmap after I login. it isn't getting executed from the xinitrc file.
 
Old 02-01-2005, 09:20 PM   #7
linuxLuser
Member
 
Registered: Jan 2005
Distribution: Gentoo
Posts: 111

Rep: Reputation: 16
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

Last edited by linuxLuser; 02-01-2005 at 09:31 PM.
 
Old 02-01-2005, 09:55 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,004
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Graphical login managers (such as xdm, kdm, gdm) will
use the configuration file:

~/.xsession

startx uses:

~/.xinitrc

Try a
mv .xinitrc .xsession


Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
run program after user logs in kinasz Linux - General 2 09-22-2004 04:47 AM
how to get citrix automatically started up when a user logs in. sjel Linux - Newbie 2 09-06-2004 09:40 AM
Automatically run root program. Hammett Linux - Software 4 05-16-2004 01:45 PM
Program runs when a user logs in mindstormsguy Linux - Software 2 03-31-2004 06:01 PM
Getting vncserver to run automatically when user logs in indespair Linux - Networking 2 10-26-2003 03:37 AM


All times are GMT -5. The time now is 04:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration