Skip to content

Commit

Permalink
add init script so we can make the picoReflow server autostart on boo…
Browse files Browse the repository at this point in the history
…t, just run the commands (see readme) and it should start on boot
  • Loading branch information
Igor-Rast committed Sep 3, 2016
1 parent d7e7eeb commit c31a1af
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ All parameters are defined in config.py, just copy the example and review/change

$ ./picoReflowd.py

### Autostart Server onBoot
If you want the server to autostart on boot, run the following commands

sudo cp /home/pi/picoReflow/lib/init/reflow /etc/init.d/
sudo chmod +x /etc/init.d/reflow
sudo update-rc.d reflow defaults

### Client Access

Open Browser and goto http://127.0.0.1:8080 (for local development) or the IP
Expand Down
32 changes: 32 additions & 0 deletions lib/init/reflow
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
### BEGIN INIT INFO
# Provides: Start reflow server
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start Reflow Server
# Description: picoFlow On Raspberry Pi
### END INIT INFO


#! /bin/sh
# /etc/init.d/reflow


export HOME
case "$1" in
start)
echo "Starting Reflow Server"
/home/pi/picoReflow/picoreflowd.py 2>&1 &
;;
stop)
echo "Stopping Reflow Server"
reflow_PID=`ps auxwww | grep picoreflowd.py | head -1 | awk '{print $2}'`
kill -9 $reflow_PID
;;
*)
echo "Usage: /etc/init.d/reflow {start|stop}"
exit 1
;;
esac
exit 0

0 comments on commit c31a1af

Please sign in to comment.