Skip to content

Instantly share code, notes, and snippets.

@tatey
Created November 12, 2015 12:52
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 tatey/0d53768eb60f7e556e91 to your computer and use it in GitHub Desktop.
Save tatey/0d53768eb60f7e556e91 to your computer and use it in GitHub Desktop.
#!/bin/sh
### BEGIN INIT INFO
# Provides: hklifxd
# Required-Start: $local_fs $network
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: hklifxd initscript
# Description: HomeKit bridge for LIFX lights
### END INIT INFO
HKLIFXD_PIN=00102003
HKLIFXD_PIDFILE=/var/run/hklifxd.pid
case "$1" in
start)
echo "Starting hklifxd with PIN $HKLIFXD_PIN"
start-stop-daemon --start \
--startas /usr/local/bin/hklifxd \
--background \
--user pi \
--pidfile $HKLIFXD_PIDFILE \
--make-pidfile \
--chuid pi \
--chdir /home/pi/.hklifx \
-- -pin $HKLIFXD_PIN
;;
stop)
echo "Stopping hklifxd"
start-stop-daemon --stop \
--user pi \
--pidfile $HKLIFXD_PIDFILE \
--retry 5
;;
*)
echo "Usage: /etc/init.d/hklifxd {start|stop}"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment