more than one command in a script

Hey folks, just getting started here with BBB.

Like many who get one of these I picked it up with a specific purpose in mind, and I want the board to start on that purpose right away… so I want to auto execute a script on startup. I’m not quite that far, and have a few tutorials to read on auto login and start. Meanwhile I’m just trying to get my script going and it won’t complete because the first command starts a “service”, mjpg-streamer, and hogs the shell so that the next command never starts (I want to start OctoPrint).

Is there some secret word like spawn, exec, start, execstart etc that will allow the first command to spawn and remain running so the second command can start?

Here’s the script so far (I wish I could figure how to copy to the clipboard from vim but…):

by the way, the only way I know to kill this script is to hit ctrl-C, which does kill mjpg-streamer, and then OctoPrint starts, but it complains that “daemon already running?”

I’ve been Googling this for a while and so far haven’t uncovered what seems like it should be simple.

I think you want to run the first program that never returns as a background process. Here are some links on how to do that:
http://www.cyberciti.biz/faq/linux-command-line-run-in-background/
http://www.thegeekstuff.com/2010/12/5-ways-to-execute-linux-command/

I think just appending an ampersand " &" at the end of your command is what you’re looking for.

Cheers,
Akhil

Thanks Akhil, I did see the & at the end of a command in some example long ago, but it wasn’t explained what it was, and honestly I thought it might be a typo :slight_smile:

I’ll check it out tonight!