LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 01-11-2011, 01:57 AM   #1
ddaas
Member
 
Registered: Oct 2004
Location: Romania
Distribution: Ubuntu server, FreeBsd
Posts: 474

Rep: Reputation: 30
startup script after login


Hello,
I want to run a script after user login (graphical - GNOME login).
In fact I want to change the wireless ip address immediately after user login.
If I run the script from /etc/rc.local it's not good because it seems to be run before user login (the wireless connection and dhclient are run after login).


Where can I run a script after X user login?

I don't want to remove gnome-network applet.

Thanks
 
Old 01-11-2011, 02:09 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

You can use .bash_profile for that. Add what you need to that file in your home directory. You can also create a file named .bash_login and put the necessary commands in there. Have a look at this thread here at LQ that's about the same thing (starting something at login).

Kind regards,

Eric
 
Old 01-11-2011, 02:14 AM   #3
ddaas
Member
 
Registered: Oct 2004
Location: Romania
Distribution: Ubuntu server, FreeBsd
Posts: 474

Original Poster
Rep: Reputation: 30
Ok, but I think .bash_profile is run when bash (the shell) starts. I don't want to open a terminal to run those commands.

Am I Right?
 
Old 01-11-2011, 02:32 AM   #4
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

AFAIK .bash_profile (if exists) gets executed right after /etc/profile, so right before logged in (showing prompt or GUI). The order is:
/etc/profile
~/.bash_profile (if exists)
~/.bash_login (if .bash_profile doesn't exist)
./.profile (if none of the other .bash files exist)
./.bashrc (for none-interactive when already logged in)

So, in my opinion it should be good to put it in .bash_profile. I, for example on my laptop have my .bash_profile that holds some commands and they get executed before my login prompt or GUI (depending which console I log in to). This site explains a bit more, and more useful, tells you how you can test it for yourself.

Kind regards,

Eric
 
  


Reply



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
samba script won't load during startup and i never get to a login screen nass Slackware 9 04-06-2009 09:47 AM
'cannot stat' script in /etc/rc.d/, try to run script at startup quintan Linux - Software 1 11-21-2005 02:53 AM
How to call a script from a system startup script? jonatito Linux - Newbie 7 11-11-2005 09:40 PM
startup/login script in debian lixy Linux - Newbie 1 03-25-2005 10:49 AM
Startup script=/etc/login.defs? ~zoey~ Linux - Newbie 2 11-12-2004 11:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 02:57 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
Open Source Consulting | Domain Registration