PermeAgility on Raspberry Pi

PermeAgility has been installed successfully on all models of Raspberry Pi computers including (A+,B,B+,B2).  It is a great way to put a full secure web server with data management on a cheap device.  The permegility-plus-reality module allows you to setup the collection of sensor readings to the database that you can access it on your home network from any web enabled device. 

Here are the steps for setting up PermeAgility on a Raspberry Pi.

Tutorials for setting up PermeAgility for IoT applications using Raspberry Pi will be coming soon.

Startup at boot

To startup PermeAgility at boot time, create the permeagility directory and randr.sh script as per the deployment instructions and create a file called permeagility in the /etc/init.d directory

sudo vi /etc/init.d/permeagility

 then paste this into it:

#!/bin/sh

### BEGIN INIT INFO

# Provides: permeagility

# Required-Start:

# Required-Stop:

# Should-Start:

# Default-Start:      2 3 4 5

# Default-Stop:   0 1         6

# Short-Description: Start PermeAgility

# Description: Run unstoppable PermeAgility

### END INIT INFO

case "$1" in

    start|"")

        echo -n "Starting PermeAgility..."

        cd /home/pi/permeagility

        ./randr.sh &

        echo "OK"

    ;;

    start|stop|status|restart|reload|force-reload)

        echo "Error: argument '$1' not supported - Use the WebUI" >&2

        exit 3

    ;;

    *)

        echo "Usage: permeagility [start]" >&2

        exit 3

    ;;

esac

:

Then make it executable

sudo chmod 755 /etc/init.d/permeagility

Then run this command to set it up to start at boot time:

sudo update-rc.d permeagility defaults

To remove it from startup at boot time:

sudo update-rc.d permeagility remove

Note that there is no provision for stop or restart as that can be invoked from the Web interface.  This ensures that only an authorized used can stop the server.  (or someone with access to kill -9)