LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices



Reply
 
Search this Thread
Old 08-14-2012, 05:44 PM   #1
julybrownie
LQ Newbie
 
Registered: Aug 2012
Posts: 6

Rep: Reputation: Disabled
how to launch different application on startup


Hi
I am new to Linux but aware of system design.
Currently i am trying to build project on one version of arm controller.
In My systems there are different application module like HMI - handle human machine interface application, COMM - module handles network module ,Keydriver etc.

Once linux boot up and comes to main() i want to run a script or code which will launch all the executable module one by one
first it will launch key driver ,then COMM then HMI as different application.

And all three will communicate with each other on IPC.

I am not sure how to run a script to run the application.

Please share some example through which i can understand it and design my systems more modular.

Please share scripts and how can I run it in program.
 
Old 08-15-2012, 04:12 AM   #2
azenenc
LQ Newbie
 
Registered: Jul 2012
Location: Mexico
Distribution: Slackware 12.2
Posts: 4

Rep: Reputation: Disabled
There is a way to create a start-up script in Slackware Linux: Create the script in your /../rc.d/ folder, name it "rc.yourscript", modify the file "rc.local" and add your script as a command line like this /../rc.d/rc.yourscript arguments-here. Don't forget to "touch rc.yourscript" and "chmod 755 rc.yourscript"
Your linux system might be different than mine, but I found this info for a different system and I just figured out how to do it on mine.
 
Old 08-15-2012, 10:19 AM   #3
julybrownie
LQ Newbie
 
Registered: Aug 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks Azenenc. I am using fedora and do you have example for this.
I was in assumption that it can be run from inside main function and once it launched system works as launch modules.
 
Old 08-15-2012, 11:48 AM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
There is no 'main()' function in a Linux system. There is a full system of host start-up scripts and configuration. These are mostly shell scripts, and you are free to customize them as you see fit. One of the easiest ways to customize your system is to add startup scripting to the file /etc/rc.local, as azenenc has already stated. There are other ways to integrate your application(s) into the startup system, but we need to know a bit about them first.
Are your applications intended to be run as background processes, not requiring user interaction? This is the easiest case to deal with. If they require user interaction, do they use a text-mode console, or do they require support from an X server and possibly other GUI infrastructure?

A very general description of the startup process is that a bootloader is invoked somehow (system dependent, but generally by a BIOS on x86 PCs), the bootloader loads a kernel, and possibly a RAM-based filesystem, and the kernel is invoked by the bootloader. The kernel starts initializing itself and the hardware, and then creates the very first userspace process, the 'init' process. In the usual case, 'init' reads a config file normally named '/etc/inittab' which tells init what to do. In most cases, this will include launching a sequence of scripts, following a convention that uses file naming patterns. The last of such scripts is the aforementioned 'rc.local'.

I hope this helps you to re-formulate your perspective and understand the basis for the questions you need to answer.

--- rod.
 
Old 08-15-2012, 01:08 PM   #5
julybrownie
LQ Newbie
 
Registered: Aug 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks Rod.
I will try to use the above tips as starting point and find that file.

By main() i was intend to mean first entry function once all initialization is done and system jump to application process.
All the process need to be background processes as they are like multiple process without user interaction and coordinating each other as we do in embedded system built on RTOS.
On Linux i am trying to this for first time.
 
Old 08-15-2012, 04:07 PM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Okay, then just look at how processes are launched in any of the /etc/init.d/.... files. Model your scripts after those. There is a tool, used to be called checkconfig, but Redhat now uses something else that I can't remember the name of, which inserts the appropriate headers and creates symbolic links for your processes to be launched at the specified runlevels. You probably want to make your processes daemons, which divorces them from any controlling tty. You can Google that.

--- rod.
 
Old 08-16-2012, 04:52 AM   #7
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,653
Blog Entries: 2

Rep: Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095
If this is a recent version of Fedora it doesn't use the SystemV init (files in /etc/init.d) anymore, but is using systemd as init system. Information on systemd for Fedora is available here: http://fedoraproject.org/wiki/Systemd

Moved: This thread is more suitable in Fedora and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 08-17-2012, 06:02 PM   #8
julybrownie
LQ Newbie
 
Registered: Aug 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Hi Tobi,

After getting tips from Azenenc and Rod i was able to find the way file system is arranged in linux based embedded system.
Most of time the rule is same on fedora also.
I am using busybox also so it takes care of Init and i can put the startup scripts to launch different process.
I will give it a try in few days as currently i am trying to get all required driver up.

Thanks a lot for the help.

While going through this i read a book called Building embedded linux system by Karim Yaghmour.
That has a complete details how system is arranged in linux and when i checked my system it follows it.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] launch application dorlack Linux - Newbie 7 01-12-2012 08:28 AM
how to launch an application from anywhere? TigerLinux Linux - Newbie 15 11-01-2010 11:13 AM
Unable to launch application from workstation but able to launch from vnc chaitanya1982 Linux - Desktop 2 04-30-2010 04:52 AM
[SOLVED] To launch an application divyashree Linux - Software 4 10-03-2009 07:24 AM
How do you find an application using launch application pnoise Linux - Newbie 1 01-11-2009 11:44 PM


All times are GMT -5. The time now is 10:17 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration