3

I am running a Raspberry Pi with Fadecandy to control LEDs. I have everything set up, i just want to have the Fadecandy server and my exported Processing sketch run at start up.

In rc.local I am calling a script called startup.sh, which contains the following:

#! /bin/sh

/home/pi/sketchbook/leds/loading/application.linux64/loading &
/usr/local/bin/fcserver &

The second line (the fcserver) is running, the server starts up fine. The first line (the application) does not seem to be running at all.

However, if I call that script (or rc.local) from the terminal, both lines run and the application starts.

I know that if there is an error, rc.local will exit, but that doesn't seem to be the issue when the second line is running after the first line doesn't.

What am I doing wrong? Any help would be really appreciated

1
  • What does the application do? if it's a desktop program then rc.local isn't the right place/time to start it Commented May 12, 2017 at 11:28

1 Answer 1

2

My guess would be that fcserver runs daemonized - ie forks and disassociates from the running shell, whereas your loading program does not.

What happens when your script is run by init, is that it spawns a new shell (/bin/sh in your case), runs both loading and fcserver in the background in that shell,... and then destroys that shell, which implicitly sends a HUP to all child processes. Fcserver survives that because it is daemonized, whereas loading does not.

You could try prefixing your loading invocation with nohup:

#! /bin/sh

nohup /home/pi/sketchbook/leds/loading/application.linux64/loading &
/usr/local/bin/fcserver &

I am unsure if nohup is available on your Raspberry Pi - I have none to check.

2
  • Why wouldn't the same happen if the script is started manually from a terminal?
    – ilkkachu
    Commented May 12, 2017 at 10:35
  • Hmm - that is a good point @ilkkachu! Perhaps it is not the new shell that is the problem, but the one which calls the script? I would test if, after you run the script in the terminal, then quit that terminal, do both still run, or only fcserver Commented May 12, 2017 at 10:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .