LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-28-2007, 04:22 AM   #1
vimmi
LQ Newbie
 
Registered: Feb 2007
Posts: 1

Rep: Reputation: 0
Question 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.

thanks.
 
Old 02-28-2007, 05:43 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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.
 
Old 02-28-2007, 09:05 AM   #3
Pioner
LQ Newbie
 
Registered: Feb 2007
Location: Moscow
Distribution: Fedora Core 6
Posts: 12

Rep: Reputation: 0
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.
 
Old 02-28-2007, 02:56 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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...
 
Old 02-28-2007, 04:19 PM   #5
alienDog
Member
 
Registered: Apr 2004
Location: Europe
Distribution: Debian, Slackware
Posts: 505

Rep: Reputation: 48
Quote:
Originally Posted by Pioner
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.

Last edited by alienDog; 02-28-2007 at 04:24 PM.
 
  


Reply



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
Starting C application automatically after booting nitinmhetre Linux - Newbie 1 01-04-2007 03:06 AM
Running VMWare tools automatically while Linux (Any Distro) starts or boots? mavinashbabu Linux - Newbie 2 09-10-2006 02:57 PM
running BSD application directly from Linux farnell_mark Linux - Newbie 0 10-15-2004 11:18 PM
Running application after installing(New to linux) farrukh Linux - General 2 05-07-2004 03:42 AM
Running third party application after installing(New to linux) farrukh Linux - Software 1 05-06-2004 03:15 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:02 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