LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   how to launch different application on startup (https://www.linuxquestions.org/questions/fedora-35/how-to-launch-different-application-on-startup-4175422096/)

julybrownie 08-14-2012 04:44 PM

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.

azenenc 08-15-2012 03:12 AM

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.

julybrownie 08-15-2012 09:19 AM

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.

theNbomr 08-15-2012 10:48 AM

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.

julybrownie 08-15-2012 12:08 PM

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.

theNbomr 08-15-2012 03:07 PM

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.

TobiSGD 08-16-2012 03:52 AM

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.

julybrownie 08-17-2012 05:02 PM

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.


All times are GMT -5. The time now is 08:44 PM.