Skip to content

Instantly share code, notes, and snippets.

@TinajaLabs
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TinajaLabs/967691d4bd62d3565d44 to your computer and use it in GitHub Desktop.
Save TinajaLabs/967691d4bd62d3565d44 to your computer and use it in GitHub Desktop.
This is an init file for Raspberry Pi, Raspbian which can automatically launch a python script at boot-up
#! /bin/sh
# /etc/init.d/tinaja_sensors
### BEGIN INIT INFO
# Provides: tinaja_sensors
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Tinaja_Sensors initialisation
### END INIT INFO
<pre>PIDFILE=/var/run/tinaja_sensors.pid</pre>
<pre>case "$1" in
start)
echo "Starting Tinaja_Sensors"
# run application you want to start
python /home/tinaja/sensorgate2.py &amp;
;;
stop)
echo "Stopping Tinaja_Sensors"
# kill application you want to stop
killall python
;;
restart)
echo "Restarting Tinaja_Sensors.."
$0 stop
$0 start
;;
*)
echo "Usage: /etc/init.d/tinaja_sensors start|stop"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment