Skip to content

Commit

Permalink
Running Blynk server as service and update setup script
Browse files Browse the repository at this point in the history
  • Loading branch information
Nander Hokwerda committed May 30, 2019
1 parent 87d9ed6 commit 74dbaf4
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 2 deletions.
1 change: 1 addition & 0 deletions Software/Controller/Controller.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="blynk_server" />
<Content Include="README.md" />
<Content Include="requirements.txt" />
<Content Include="setup.sh" />
Expand Down
35 changes: 35 additions & 0 deletions Software/Controller/blynk_server
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#! /bin/sh
# /etc/init.d/blynkserver

### BEGIN INIT INFO
# Provides: blynkserver
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Simple script to start a program at boot
# Description: A simple script from www.stuffaboutcode.com which will start / stop a program a boot / shutdown.
### END INIT INFO

# If you want a command to always run, put it here

# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting Blynk Server"
# run application you want to start
java -jar /opt/blynkserver/server-0.41.6-java8.jar -dataFolder /opt/blynkserver/data &
;;
stop)
echo "Stopping Blynk Server"
# kill application you want to stop
PID = ps -ef | grep 'blynk' | grep -v grep | awk '{print $2}' | tail -n 1
kill $PID
;;
*)
echo "Usage: /etc/init.d/blynkserver {start|stop}"
exit 1
;;
esac

exit 0
17 changes: 15 additions & 2 deletions Software/Controller/setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
apt-get update
apt-get install build-essential python3-dev python3-smbus git openjdk-8-jdk

apt-get dist-upgrade

apt-get install build-essential python3-dev python3-smbus git openjdk-8-jdk python3-pip

pip3 install -r requirements.txt

Expand All @@ -13,7 +16,17 @@ cd ..

mkdir /opt/blynkserver

wget "https://github.com/blynkkk/blynk-server/releases/download/v0.41.6/server-0.41.6-java8.jar" -O /opt/blynkserver
wget "https://github.com/blynkkk/blynk-server/releases/download/v0.41.6/server-0.41.6-java8.jar" -P /opt/blynkserver

mkdir /opt/blynkserver/data

cp blynk_server /etc/init.d

chmod 755 /etc/init.d/blynk_server

update-rc.d blynk_server defaults

/etc/init.d/blynk_server start

echo "Default credentials to log into the local Blynk server are: admin@blynk.cc : admin . To change this log into the web UI on port 9443"

Binary file not shown.
Binary file not shown.

0 comments on commit 74dbaf4

Please sign in to comment.