Created
November 12, 2015 12:52
-
-
Save tatey/0d53768eb60f7e556e91 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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