Reply
Posts: 5
Registered: ‎09-04-2015

Host application (Linux) running as daemon process

Hi all,

 

I have been running SL Ember Zigbee stack for a number of years now using ncp/ezsp configration, on EFM32GG and EM357 (running on Keil RTX). However now I am porting the host application to run on Linux.

 

The question: Can the host application, (which was generated using S.L AppBuilder - part of Studio)  run as a background Linux process? (making it to be a daemon - and starting it from /etc/init.d/XXX).

 

I can run my host application (which is a Coordinator) and runs perfectly fine. However, putting it to the background, as a process, is a problem.

 

Looking at file app/util/serial/linux-serial.c, in some comments, tells me that that the program can be run as a background. I can see the creation of pipes and creation of child thread etc. but I can't see anything which handles input from STDIN.

 

If I start the application from /etc/init.d then the readline function (which reads from STDIN) is getting an EOF character. I am pretty sure that application should not be reading from STDIN directly like this and should channel the STDIN to one of the pipes instead.

 

Can anyone here confirms with me that it does or doesn't or it is suppose to be OK to run as a background process?

 

Thank you very much,

 

wanindra

 

 

Configuration info:

Host application created using AppBuilder - running as Coordinator using 5.7.0 GA build 411.

Cross compile using:

arm-linux-gnueabihf-gcc

 

Running on:

Linux abc 3.14.28-tm1 #1 SMP PREEMPT Thu Sep 15 08:43:31 BST 2016 armv7l GNU/Linux

 

<a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Hero</font></font> </a> YK
Posts: 107
Registered: ‎02-13-2017

Re: Host application (Linux) running as daemon process

It is supposed to be OK to run Host application as a background process.

Posts: 5
Registered: ‎09-04-2015

Re: Host application (Linux) running as daemon process

Hi @YK thank you very much for the answer.

 

I was hoping that you would elaborate your answer a bit.

 

Would you mind telling me what OS that you were running on, and the method you used to start the application/process?

 

Also how did you handle the stdin and stderr messages which the application was giving out?

 

Thank you again.

 

Posts: 6
Registered: ‎03-22-2017

Re: Host application (Linux) running as daemon process

I also have this problem.

My ezsp stack runs from PHP script with this command:

 

exec('bash -c "exec nohup setsid /root/ezsp -p /dev/ttyAPP0 -b 57600   > /dev/null  &"');

 

And the stack does not start.

 

exec('bash -c "exec nohup setsid /root/dummy |  /root/ezsp -p /dev/ttyAPP0 -b 57600   > /dev/null  &"');

 

where dummy - program which makes putchar (" "); infinitely.

In this case the stack starts.

I know that is terrible method, but I cant find the better decision.