public
Last active

raspberry pi scripts

  • Download Gist
format-sd-card.sh
Shell
1 2 3 4 5 6 7 8
# this formats a sd card to boot raspberry pi, you can then hook up to raspi over ethernet cable from
# a mac computer. turn on internet sharing in sys prefs first and then the raspi should be 192.168.2.2
# first download http://www.raspberrypi.org/downloads and unzip to raspbian.img
# you might have to change the device name, /dev/disk1s1 is what mac os usually mounts sd cards as
# the dd command might take a couple of minutes, hit ctrl+t to check status
sudo diskutil unmount /dev/disk1s1
sudo dd bs=1m if=raspbian.img of=/dev/rdisk1
sudo diskutil eject /dev/rdisk1
index.js
JavaScript
1 2
require('http').createServer(handler).listen(80)
function handler(req, res) { res.end('hello world!') }
mongroup.conf
1 2 3
pids = /var/run/
logs = /var/log/
web = node /home/pi/index.js
readme.md
Markdown

raspberry pi setup stuff

what these instructions/files are useful for:

  • make raspberry pi run processes (like node.js servers) automatically on startup and have them monitored by a process monitor
  • get node running on the pi
  • install the raspbian OS on an sd card and boot the pi up and login over ssh

notes/instructions

  • after cloning the stuff in setup.sh you'll have to make and make install everything manually. node will take hours to compile
  • put mongroup.conf in /home/pi/mongroup.conf
  • put mongroup-startup.conf in /etc/init/mongroup.conf
  • you can add new lines to ~/mongroup.conf to configure new things that should always be running when the raspi is on
  • if you do the raspi-config sd card expand thing it may cause your next restart to take a lonnnggg time
setup.sh
Shell
1 2 3 4 5 6 7
#!/bin/sh
sudo apt-get upgrade
sudo apt-get install build-essential libssl-dev git screen avahi-daemon vim upstart
mkdir src
git clone https://github.com/joyent/node.git src/node
git clone https://github.com/visionmedia/mon.git src/mon
git clone https://github.com/jgallen23/mongroup.git src/mongroup
startup-mongroup.conf
1 2 3 4 5 6 7 8
description 'startup processes'
author 'maxogden'
 
start on runlevel [0123456]
 
task
 
exec start-stop-daemon --start -u pi --chdir /home/pi --exec /usr/local/bin/mongroup start

when I try to compile node on my pi w/this I consistently get:
Illegal instruction
make[1]: *** [/home/pi/src/node/out/Release/obj.target/v8_snapshot/geni/snapshot.cc] Error 132
make[1]: Leaving directory `/home/pi/src/node/out'
make: *** [node] Error 2

I have the 256mb version is yours the 512mb? Having a bitch of a time trying to get a recent node version to run on it. Thoughts?

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.