LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-11-2007, 07:35 AM   #1
satyanarayanam
LQ Newbie
 
Registered: Dec 2007
Posts: 4

Rep: Reputation: 0
how we can run our own program at booting time


Hi to all,

I am running linux 2.6 in embedded board,it will giving sheel promt directly,I have program that must run immediately afterbooting automatically,

In Image we have only inittab and rc in etc directory,

I tied alot by changing things in etc/inittab and etc/rc but it is not waiting for input from keybord ...

Anybody please help what to do?


Thank you in Advance
 
Old 12-11-2007, 08:29 AM   #2
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Usually in Linux systems the scripts in /etc/rc.d or init.d are executed during boot, rc.local usually being the last one. That's the most direct way I can imagine..
 
Old 12-11-2007, 08:40 AM   #3
satyanarayanam
LQ Newbie
 
Registered: Dec 2007
Posts: 4

Original Poster
Rep: Reputation: 0
But it is not waiting for input?

Hi,

I puted my progrm executable path in rc,

in that program i am asking data from keyboard,But it is not waiting ,taking data like "" ,

Actually i ahave to wait for data ,can wait for input at time of booting...?

Thank you
 
Old 12-11-2007, 10:21 AM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Wait a minute, you want a program/app to be invoked during bootup that waits for actual user input?
 
Old 12-11-2007, 11:10 AM   #5
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 999

Rep: Reputation: 142Reputation: 142
Perhaps you mean that the program must run just after a user (or any user) logs in? In this case you could start the program by inserting its path into "~/.profile", or?
In my case I wanted to start up X whenever the user was logging in through the console that appears just after the boot sequence ends, but not when other users (or the same one) was logging in through ssh or other local terminals, so I wrote the following .profile file:
Code:
VIA ~ # cat ~/.profile 
echo "This is your .profile script"
TERMINAL=$(tty)

if [ "$TERMINAL" = "/dev/tty1" ]
then
        echo "This is the main terminal, so I am starting up X"
        /home/shared/scripts/startx_custom
else
        echo "This is a secondary terminal, so I won't start up X"
fi
 
Old 12-11-2007, 11:35 PM   #6
satyanarayanam
LQ Newbie
 
Registered: Dec 2007
Posts: 4

Original Poster
Rep: Reputation: 0
exactly ,i am waitng for input when bootup through my program?

Quote:
Originally Posted by trickykid View Post
Wait a minute, you want a program/app to be invoked during bootup that waits for actual user input?
Hi,

yes i am waiting for input when bootup but,it is not waiting,
MY program path is in etc/rc file..,it's running but not waiting?

Thank you
 
Old 12-11-2007, 11:37 PM   #7
satyanarayanam
LQ Newbie
 
Registered: Dec 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Pearlseattle View Post
Perhaps you mean that the program must run just after a user (or any user) logs in? In this case you could start the program by inserting its path into "~/.profile", or?
In my case I wanted to start up X whenever the user was logging in through the console that appears just after the boot sequence ends, but not when other users (or the same one) was logging in through ssh or other local terminals, so I wrote the following .profile file:
Code:
VIA ~ # cat ~/.profile 
echo "This is your .profile script"
TERMINAL=$(tty)

if [ "$TERMINAL" = "/dev/tty1" ]
then
        echo "This is the main terminal, so I am starting up X"
        /home/shared/scripts/startx_custom
else
        echo "This is a secondary terminal, so I won't start up X"
fi
Hi,

Is this ~/.profile means .bash_profile or it's different file,
if it is differnet my linux don't have that? what to do next?

Thank you in advance...
 
Old 12-12-2007, 06:01 AM   #8
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 999

Rep: Reputation: 142Reputation: 142
The name might be different and if it does not exist yet, jut create it. In my case it wasn't existing. And yes, I use Bash as a terminal and normally the bash file is called ".profile", but I don't exclude that in your case it might be called ".bash_profile".
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to test a run-time of a C program frankie_DJ Programming 2 10-07-2006 04:03 AM
finding the time it takes for a program to run Valkyrie_of_valhalla Linux - Software 1 07-28-2006 05:19 AM
call other program at run time Xiangbuilder Programming 4 10-01-2003 09:53 AM
How to make our program run at booting ssatheesh Linux - Software 2 03-01-2003 10:41 AM
How to run binary at booting time hai_rajneesh Linux - Software 2 06-23-2002 03:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:56 PM.

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