How to autostart application

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to autostart application

跳至解决方案
3,087 次查看
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.

标记 (2)
0 项奖励
1 解答
1,857 次查看
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 项奖励
3 回复数
1,857 次查看
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 项奖励
1,858 次查看
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 项奖励
1,857 次查看
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 项奖励