LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   how we can run our own program at booting time (https://www.linuxquestions.org/questions/linux-general-1/how-we-can-run-our-own-program-at-booting-time-606034/)

satyanarayanam 12-11-2007 07:35 AM

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

b0uncer 12-11-2007 08:29 AM

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..

satyanarayanam 12-11-2007 08:40 AM

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

trickykid 12-11-2007 10:21 AM

Wait a minute, you want a program/app to be invoked during bootup that waits for actual user input?

Pearlseattle 12-11-2007 11:10 AM

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


satyanarayanam 12-11-2007 11:35 PM

exactly ,i am waitng for input when bootup through my program?
 
Quote:

Originally Posted by trickykid (Post 2987221)
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

satyanarayanam 12-11-2007 11:37 PM

Quote:

Originally Posted by Pearlseattle (Post 2987277)
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...

Pearlseattle 12-12-2007 06:01 AM

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".


All times are GMT -5. The time now is 12:02 PM.