Monday, July 27, 2009

How to add a c program in startup in linux?

i want to run a c program.. by default after booting and logging in..





help me out...

How to add a c program in startup in linux?
Assuming your program is /home/gnanaprakash/bin/a.out





then...





1. Edit the below file using "vi" or your favorite editor


$ vi $HOME/.bashrc





2. Add the below as the last line of the file


/home/gnanaprakash/bin/a.out





3. Save the file.





4. Next time you login the program will get executed
Reply:"After booting" and "after logging in" are two completely different things.





To start it after booting, you need to write a shell script that will start your program that will look like this:





case $1 in


start)


/home/cucombre/myprogram


;;


esac





and put it into /etc/rc2.d directory (don't forget to make the script executable using chmod).





For logging in, place a command into the file .profile or .bash_profile in your home directory or /etc/profile to affect all users.
Reply:what GUI do you use? if KDE:





compile the program, put the binary in:





/home/username/.kde/Autostart

geranium

No comments:

Post a Comment