Stability Issue of rc.local To Run Scripts At Start Up

Applications, development tools, FPGA, C, WEB
Post Reply
bryan.hayes
Posts: 6
Joined: Mon May 15, 2017 6:05 pm

Stability Issue of rc.local To Run Scripts At Start Up

Post by bryan.hayes » Tue Jul 18, 2017 9:40 pm

Hello All,

Physics graduate student here. Currently I'm using the Red Pitaya as a multi-channel analyzer for radiation detectors. I've had great success with it so far. The RP may replace other, more expensive equipment pending its performance in the field. The goal for our lab is to fly the RP with a detector on a balloon to take measurements of cosmic radiation.

The problem I can not seem to get past is the stability of the rc.local file. I'm able to write code to run my C script continuously. It works perfectly at first, but at some random time later the Red Pitaya freezes at boot up. This is indicated by LED-1 turning off and LEDs 2-4 freezing. Also, connection via ssh is refused.

Here's my code for rc.local :

Code: Select all

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

cat /opt/redpitaya/fpga/fpga_0.94.bit > /dev/xdevcfg

while true; do
	/RedPitaya/MCA/trigger/RUN
done

exit 0
With RUN being my executable.

My RP is on the latest stable image(redpitaya_ubuntu_15-04-44_23-feb-2017.img). Editing rc.local back into it's original form does not solve the problem. I have to completely wipe and re-install the SD card image.

Any help or suggestions would be greatly appreciated :D

jeanminet
Posts: 33
Joined: Tue Aug 25, 2015 12:17 pm
Contact:

Re: Stability Issue of rc.local To Run Scripts At Start Up

Post by jeanminet » Wed Jul 19, 2017 6:06 pm

The recommended way is to use sytemd.

You could try to create a file /etc/systemd/system/myservice.service:

Code: Select all

[Unit]
Description=My start up script

[Service]
ExecStart=/usr/bin/bash /usr/local/myscript.sh

[Install]
WantedBy=multi-user.target
and your startup script /usr/local/myscript.sh :

Code: Select all

cat /opt/redpitaya/fpga/fpga_0.94.bit > /dev/xdevcfg

while true; do
   /RedPitaya/MCA/trigger/RUN
done

exit 0
Then run the command

Code: Select all

$ systemctl enable myservice.service
and finally reboot.

bryan.hayes
Posts: 6
Joined: Mon May 15, 2017 6:05 pm

Re: Stability Issue of rc.local To Run Scripts At Start Up

Post by bryan.hayes » Wed Jul 19, 2017 9:08 pm

Hey jeanminet. Thanks for the reply.

I found one error in your myservice.service file:

Code: Select all

[Service]
ExecStart=/usr/bin/bash /usr/local/myscript.sh
Should be:

Code: Select all

[Service]
ExecStart=/bin/bash /usr/local/myscript.sh
I poked around and saw that there is no /usr/bin/bash file or directory after it failed to work. After testing a dozen or so reboots I have no problems so far.

Thank you for the help!
Bryan

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 9 guests