Last active
May 8, 2017 20:23
-
-
Save micw/2194865e463e6ed77ddd4150b386cb02 to your computer and use it in GitHub Desktop.
Homeassitant rc script
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
| #!/sbin/openrc-run | |
| CONFIG_DIR=/etc/homeassistant | |
| USER=hass | |
| GROUP=daemon | |
| PIDFILE=/var/run/homeassistant/homeassistant.pid | |
| CMD="/usr/bin/hass" | |
| ARGS="-c ${CONFIG_DIR} --pid-file ${PIDFILE}" | |
| depend() { | |
| use dns | |
| } | |
| start() { | |
| mkdir -p /var/log/homeassistant | |
| chown -R ${USER}.${GROUP} /var/log/homeassistant | |
| mkdir -p /var/run/homeassistant | |
| chown -R ${USER}.${GROUP} /var/run/homeassistant | |
| ebegin "Starting ${SVCNAME}" | |
| start-stop-daemon --pidfile $PIDFILE -u $USER -g $GROUP -b \ | |
| -1 /var/log/homeassistant/homeassistant.log \ | |
| -2 /var/log/homeassistant/homeassistant.log \ | |
| -x $CMD -- $ARGS | |
| eend $? | |
| } | |
| stop() { | |
| ebegin "Stopping ${SVCNAME}" | |
| start-stop-daemon --pidfile $PIDFILE -u $USER -g $GROUP -x $CMD -K -q | |
| eend $? | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment