PDA

View Full Version : Identifying when embedded Linxu really is up



RolandHughes
4th February 2015, 21:27
All,

I don't normally go messing around with bootstrap code or any other such thing, but it appears those who put the BitBake BusyBox build together for this project aren't really around anymore. I absolutely know what is wrong though I'm just now starting to look at it. There were two idiots.

The first is/was the systems team/person/people who are launching stuff at startup rather willy-nilly then dropping straight into launching the application without including any mechanism what-so-ever of determining if basic services like Alsa and Telnet have actually completed. What is the simplest method of determining if Alsa and Telnet (for now) have completed startup? I mean simplest way from inside one of these init.d type scripts. Keep in mind I try to avoid any and all type of involvement with linux scripting, so make no claims to knowledge or skills in it. (If it was something robus like DCL, I could hack out a beautiful 5K line script in an afternoon without problem. Not so much with this stuff.)

While poking around for this answer I will begin fixing the code of the second idiot who assumed the OS would always be there and didn't check any return values thus causing the application to crash periodically on cold boot because either the sound didn't get started or, more often, the network didn't complete configuring itself before the app tried to use it full throttle.

Thanks,

RolandHughes
4th February 2015, 23:28
Never mind, I figured it out. After reading through each of the scripts in /etc/init.d I found most were making sure a volital /tmp directory was writeable. Just modified each of the "required' items to write a one line file to that directory. The application startup script then checks the contents of each file in a loop until it finds the values it wants or has tried too many times. Yes, I stuck a sleep in too.

wysota
5th February 2015, 00:43
All,

I don't normally go messing around with bootstrap code or any other such thing, but it appears those who put the BitBake BusyBox build together for this project aren't really around anymore. I absolutely know what is wrong though I'm just now starting to look at it. There were two idiots.

The first is/was the systems team/person/people who are launching stuff at startup rather willy-nilly then dropping straight into launching the application without including any mechanism what-so-ever of determining if basic services like Alsa and Telnet have actually completed. What is the simplest method of determining if Alsa and Telnet (for now) have completed startup? I mean simplest way from inside one of these init.d type scripts. Keep in mind I try to avoid any and all type of involvement with linux scripting, so make no claims to knowledge or skills in it. (If it was something robus like DCL, I could hack out a beautiful 5K line script in an afternoon without problem. Not so much with this stuff.)

While poking around for this answer I will begin fixing the code of the second idiot who assumed the OS would always be there and didn't check any return values thus causing the application to crash periodically on cold boot because either the sound didn't get started or, more often, the network didn't complete configuring itself before the app tried to use it full throttle.

Thanks,

Usually services started with init scripts create a file with their name in /var/run or similar (/run, /var/spool/run) containing their pid. You can check that directory for what you need. Alternatively running "service servicename status" should return the status of a service (usually based on that pid file in /var/run). For completeness I have to say that the original u*ix way of ordering startup scripts is via /etc/rc?.d/* and that's where you should probably start.

I really don't like your idea of creating files in /tmp. That directory is to be used in some other manner.

Not that this question has anything to do with Qt...