How to autostart application

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to autostart application

Jump to solution
3,026 Views
patsandt
Contributor III

I'd like to autostart my application on boot. (This seems like something others would have done.) I'm using a board derived from the Sabre board with iMX6. I'm running Linux. Searches online have yielded suggestions based on inittab (does not exist), init.d, rc.d, etc. I've added a script to init.d, rc1.d, rc2.d, rc3.d, rc4.d, rc5.d, rc6.d, and rcS.d. None of these result in running the script.

I can run the script manually after logging in, but the goal is to avoid logging in. That is, the device I'm writing for has no GUI at all.

Any hints are appreciated. I normally run from TeraTerm running the console.

Tags (2)
0 Kudos
1 Solution
1,796 Views
b36401
NXP Employee
NXP Employee

Actually adding the script into rcX.d is a good idea.

First please check which runlevel your system is actually running:

# runlevel
N 3
#

And then you can add your script into this exact runlevel.
Its name should starts with "S" that means "start".
The "S" should be followed with 2 digits, this number is used for start seqence - S01* starts prior to S02*, and so on to S99*.
Also please make sure that it is canonical shell script with something like "#!/bin/sh" in first line and has good permissions (755 for example).
Then the script will be executed with system start up with "start" parameter.
However please note that process environment incomplete. It has no $PATH, etc.

Have a great day,
Victor

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
3 Replies
1,796 Views
patsandt
Contributor III

I did have some convoluted FILES_${PN} instances that were interfering with each other. By correcting these and changing the names, I now have the script running on startup.

0 Kudos
1,797 Views
b36401
NXP Employee
NXP Employee

Actually adding the script into rcX.d is a good idea.

First please check which runlevel your system is actually running:

# runlevel
N 3
#

And then you can add your script into this exact runlevel.
Its name should starts with "S" that means "start".
The "S" should be followed with 2 digits, this number is used for start seqence - S01* starts prior to S02*, and so on to S99*.
Also please make sure that it is canonical shell script with something like "#!/bin/sh" in first line and has good permissions (755 for example).
Then the script will be executed with system start up with "start" parameter.
However please note that process environment incomplete. It has no $PATH, etc.

Have a great day,
Victor

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,796 Views
patsandt
Contributor III

That was useful information and I've changed the names to reflect that

information. I realized that to avoid "installed but not shipped" errors in

the past, I had installed to /home/root rather than system directories.

This technique does not work for these scripts.

I've edited bitbake.conf to add "$/*" to the FILES_$ list,

but continue to get the same QA issues.

I would like to know what to change to create these files in the installed

image before reaching the login prompt. Any clues?

0 Kudos