Skip to content

Instantly share code, notes, and snippets.

@tatey tatey/hklifxd.sh
Created Nov 12, 2015

Embed
What would you like to do?
#!/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
You can’t perform that action at this time.