LinuxQuestions.org
Review your favorite Linux distribution.
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 10-27-2004, 10:22 AM   #1
openart
LQ Newbie
 
Registered: Oct 2004
Posts: 6

Rep: Reputation: 0
Automatic execution of a command after login


Hi,
I put these 3 lines at the end of my rc.local file.

echo Hello denis
login -f root
echo Hello denis

The first "Hello denis" is execute and i see it,
then compare the command line
but the last "hello denis" isn't execute!!!! why?
can you help me?

thanks
bye

Denis
 
Old 10-27-2004, 01:45 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
It will display once you logout, that is if the
login -f root is run to completion.



Cheers,
Tink
 
Old 10-27-2004, 01:47 PM   #3
etherag
LQ Newbie
 
Registered: Aug 2004
Posts: 15

Rep: Reputation: 0
I'm not positive on this, but I think what happens is that the login command essentially ends the rc.local's execution. Are you booting into the command line or the gui? If you're loading into the gui, there are better ways to run commands, using a user's .xinitrc file.
 
Old 10-28-2004, 03:05 AM   #4
openart
LQ Newbie
 
Registered: Oct 2004
Posts: 6

Original Poster
Rep: Reputation: 0
yes...now I see that it will display when logout...mmm

I'm booting into the command line...and I will automatically execute a command (or a program) after the login....is it possible?
can you help me?

many thanks
 
Old 10-28-2004, 02:13 PM   #5
etherag
LQ Newbie
 
Registered: Aug 2004
Posts: 15

Rep: Reputation: 0
Do you want the script to run regardless of who is logging in, or do you want different (or no) scripts for different users?

If you want to have a general startup script for all users, you can insert the script into /etc/init.d, and then use chkconfig to enable it for the run levels you want it to run at.

i.e.

make /etc/init.d/boot.script

then type

chkconfig 3 boot.script on

this will enable the boot.script file in runlevel 3. It will create a symbolic link to the script in /etc/rc.d/rc3.d/ That way, whenever the computer enters runlevel 3, it should run. If you want user level scripting... it's definitely doable, but I'm not positive on how to do it for the command line.

Oh, and the chkconfig tool is redhat specific, so if you're using a different distro, you might have to do it manually, download chkconfig, or use a similar tool. I know gentoo, debian, and suse have similar functions, but with different names. Something like rc-update I think.

This post had something similar, it might be of interest.

h**p://www.realvnc.com/pipermail/vnc-list/2004-July/046195.html


OK... just talked to a friend fo mine about it, and there is an easier way for post login stuff to run in command line. In each user's home directory, there is a file called .bashrc or .cshrc depending on which shell you use. anything in that file will be run after that user logs in. That's probably your best bet....
 
Old 10-29-2004, 02:44 AM   #6
openart
LQ Newbie
 
Registered: Oct 2004
Posts: 6

Original Poster
Rep: Reputation: 0
I resolved my problem without execute the command after the login...

....but you give me some interesting info and now I will try it...

thanks

bye
 
  


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
command execution time minil Programming 10 08-20-2010 05:59 PM
can I check the execution of this command? kushalkoolwal Programming 1 10-21-2005 09:44 PM
php command execution problem avswamy Programming 3 01-31-2005 05:55 AM
command execution leonidas Linux - General 1 09-22-2004 01:29 AM
Telnet command execution history deadCenter Linux - Newbie 3 05-13-2003 02:31 PM


All times are GMT -5. The time now is 05:29 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration