Autostart SFW-RPI

Friday, 14 Jun. 2013

Autostart SFW on startup of the Raspberry pi

With the following startup script we can run the Smallest Federated Wiki automatically on reboot of the RaspberryPi.

go to init.d

cd /etc/init.d

create a new script "sfwstarter"

sudo nano sfwstarter

paste this inside the script (if you followed this example then SFW should be in /opt/apps)

#!/bin/bash
### BEGIN INIT INFO
# Provides:          sfwstarter
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Start the Smallest-Federated-Wiki express server on startup.
# Created by:        Bauwe Bijl http://bauwe.nl
### END INIT INFO
cd /opt/apps/Smallest-Federated-Wiki/server/express/bin && sudo node server.js

save (Ctrl-x)

edit the permissions to make it executable

sudo chmod 755 /etc/init.d/sfwstarter

add it to the startup scripts

sudo update-rc.d sfwstarter defaults

restart the pi

sudo init 6