Community
cancel
Showing results for 
Search instead for 
Did you mean: 
New Contributor I
1,123 Views

Run specific process based on Connectivity

Hi,

I'm using meta image and Intel edison arduino expantion board .I'm configuring edison to wifi using command configure_edison --wifi. I want to blink led when there is no network and keep the led constant if there is network (internet connection) and I want to repeat the process continuously in the background. I tried the following things.

1)I tried reading the status using wpa_cli status and wpa_cli reconfigure ,but as I want to continuously monitor the process in the background,there are some memory issues.Same problem if I tried with the ping command in background.

2)I tried writing the service as provided in the link https://www.losant.com/blog/edison-automatic-process-startup https://www.losant.com/blog/edison-automatic-process-startup .But it is also in vain.I'm unable to run the two binaries (led blink and led_constant) in single service.

Can you please let me know the process should I follow or any other approach to get my process done.Thanks in advance.Please do needful.

Thanks and Regards,

Radhika.

Tags (1)
0 Kudos
4 Replies
Community Manager
29 Views

Hello Radhika,

 

 

Thank you for your interest in Intel® Edison Breakout Board.

 

 

From what I read, I infer that each program can run effectively as long as they are not ran together. Could you please share each code (led blink and led constant)? I want to know how you are checking if the Edison is connected to a network.

 

 

When you used the system service approach, what was the result? Please check this other guide to create a system service: https://communities.intel.com/docs/DOC-111103 https://communities.intel.com/docs/DOC-111103.

 

 

I'll be waiting for your response.

 

 

Have a nice day.

 

 

Regards,

 

Andres V.
0 Kudos
New Contributor I
29 Views

Hi Andres,

Thanks for the reply,I have written the script based on network online.target after .But my need is to make led constant after connectivity and blink led if there is no connectivity. How can I include two binaries in one service file based on connectivity. Can you please let me know how can I write service based on network online target service or any other service after and before.?

I'm pinning the led_blink.c and led.c ,led.service here.Please do needful.

Thanks and Regards,

Radhika

0 Kudos
New Contributor I
29 Views

Hi,

I tried these service files today but there is no result.I thought to write two service files one when there is network connection and second if there is no network.I have written service file before network connection using network-pre.target (blinking led) and when there is network connection using network-online.target (constant led ).But the problem is by using network-pre.target ,the led is blinking even when there is network connection (where I need to blink when there is no network) and the other service file using network-online.target is always in inactive state (even if there is network connection) .Sometimes led_constant.service is failing.

The service files I have used are led_blink9.service,led_const.service,led_blink.service as trail .The process I'm following is same as mentioned in the given link http://shawnhymel.com/792/run-a-script-on-edison-boot/ http://shawnhymel.com/792/run-a-script-on-edison-boot/ and I'm attaching some screenshots too.Please let me know how to write approach for this and fulfil my need.

Referred links:

https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/ https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/

https://unix.stackexchange.com/questions/126009/cause-a-script-to-execute-after-networking-has-start... systemd - Cause a script to execute after networking has started? - Unix & Linux Stack Exchange

https://superuser.com/questions/1005742/how-to-run-script-before-the-network-configuration linux - How to run script before the network configuration? - Super User

https://fedoramagazine.org/systemd-unit-dependencies-and-order/ systemd: Unit dependencies and order - Fedora Magazine

https://askubuntu.com/questions/753909/help-understanding-and-debugging-slow-boot-with-systemd-netwo... kubuntu - Help understanding and debugging slow boot with systemd network-online.target - Ask Ubuntu

In the given service files led is the binary for constant led and led1 is binary for blinking led.Please do needful.Thanks in advance.

0 Kudos
Community Manager
29 Views

Hello Radhika,

Thanks for the information provided.

I checked the code provided but I think your issue is more programming-related than Edison board-related.

Before thinking of implementing a system service you should write a code that identifies the connectivity state, and what you are doing is running programs before and after the network connection is detected. And that is way you should think of a different approach, function wise.

Please keep in mind that code debugging is out of the scope of this technical support team.

In these cases is where the community may provide assistance, but due to the nature of your project you should also consider posting your inquiry in a C-related or Linux-related forum. I checked the Edison community for a similar case but couldn't find information that you may find useful.

If you have any other question further in your project regarding your board, don't hesitate to contact us.

Regards,

 

Andres V.
0 Kudos