Skip to content

Instantly share code, notes, and snippets.

@rmamba
Last active August 29, 2015 13:58
Show Gist options
  • Save rmamba/10100984 to your computer and use it in GitHub Desktop.
Save rmamba/10100984 to your computer and use it in GitHub Desktop.
Install script for pyRestDB installation on RaspberryPI
#!/bin/bash
#On RaspberryPi run
#wget http://goo.gl/l9MalS -O restDB-install
#sudo chmod +x restDB-install
#sudo ./restDB-install
cd /home/pi
wget https://github.com/rmamba/pyRestDb/archive/v0.1.tar.gz -O pyRestDB.tar.gz
tar -xvf pyRestDB.tar.gz
#rename folder
mv pyRestDb-0.1 pyRestDb
chown pi:pi pyRestDb
#pyRestDB daemon installation
wget https://gist.githubusercontent.com/rmamba/1bfd4e180df1b323211c/raw/31c46dae03e08874bf75ea54c72c14848535df78/genDaemonPID.sh -O /etc/init.d/restdbd
chown pi:pi /etc/init.d/restdbd
chmod +x /etc/init.d/restdbd
sed "s/{PROGRAM}/pyRestDb.py/g" /etc/init.d/restdbd > /etc/init.d/restdbd.1
sed "s/{EXEPATH}/\/home\/pi\/pyRestDb/g" /etc/init.d/restdbd.1 > /etc/init.d/restdbd.2
sed "s/{PIDFILE}/\/var\/run\/pyRestDb.pid/g" /etc/init.d/restdbd.2 > /etc/init.d/restdbd.3
sed "s/{PARAMETERS}/> /var/log/pyRestDb.log 2>&1 &/g" /etc/init.d/restdbd.3 > /etc/init.d/restdbd.4
sed "s/# echo $!/ echo $!/g" /etc/init.d/restdbd.4 > /etc/init.d/restdbd
rm /etc/init.d/restdbd.*
echo 'Installation done'
echo 'Use: /etc/init.d/restdbd start|stop|restart'
echo 'goto http://raspberrypi-IP:666'
echo 'Use "sudo ifconfig" to get the RaspberryPi IP'
echo 'might have to run "sudo apt-get install python-flask" if you didn't install Flask yet'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment