running my application automatically on starting the linux
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
running my application automatically on starting the linux
hi ,
i have a little problem so i need help.
i developed an application for linux in C language. now i want to start my application automatically on starting the linux. so how can i do this. i know i need to write a shellscript but i dont know shell programming. so please help me.
Easiest is to find out if your system runs SysV (copy & mod one script) or BSD initscripts (add to).
If it's not a service then you can also dump it in /etc/rc.d/rc.local or equivalent.
Every time the system starts it reads file /etc/profile (or looks like this, this may vary from system to system).
You should put at end of this file string, which contains call of your programm with full path, all needed command-line arguments. Shell will read it just the same as you type in command prompt.
Every time the system starts it reads file /etc/profile (...) You should put at end of this file string, which contains call of your programm with full path
That means the app will be run each time /etc/profile is run...
Every time the system starts it reads file /etc/profile (or looks like this, this may vary from system to system).
You should put at end of this file string, which contains call of your programm with full path, all needed command-line arguments. Shell will read it just the same as you type in command prompt.
Actually /etc/profile gets run when a shell is started, and even then only when the shell is an interactive login shell (man bash). i.e. it will not get run when the system starts up, but rather when you login. /etc/rc.d/rc.local (or /etc/init.d/rc.local or /etc/rc.d/init.d/rc.local or whatever) would be the correct location for a program that will be started when the system boots.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.