Monday, March 18, 2013

Running a script as a service on Raspbian Linux

If you followed the instructions on Setting up a webcam on the Raspberry Pi, you may also want your feed to launch automatically.  The following process can also be used to run any script at boot after all other services have launched.

These instructions assume you have created broadcast.sh as instructed here.  To launch another script, just use appropriate path and script name.
rc.local script modified to launch broadcast.sh on boot

  1. Open a linux terminal
  2. sudo nano /etc/rc.local
  3. Arrow down to the "fi" of the if statement that prints the address.
  4. Hit enter and then the up arrow.
  5. type "/home/pi/broadcast.sh&" without the quotes-- Note the Ampersand "&" is important.  This allows the rc.local script to launch your script and continue to booting without hanging and waiting for your script to complete.
  6. press ctrl+x and hit "Y" to save.
Now your broadcast will start automatically when the Pi reboots.

Dr. Soriano has the live feed up and running.  The Pi webcam stream is monitoring his Chemical Ecology experiments with the cockroaches and they can be viewed here.

No comments:

Post a Comment