-
Notifications
You must be signed in to change notification settings - Fork 0
/
rf433-app.conf
39 lines (30 loc) · 1.13 KB
/
rf433-app.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!upstart
# Start & stop a NodeJS based service
#
# This file must be copied to /etc/init/ (cp /mybin/CasaC/rf433-to-rest/rf433-app.conf /etc/init/)
description "RF433 to REST bridge"
author "cat101"
# Log & PID file location
env VAR_DIR="/tmp/rf433-to-rest"
# Change this to development or production to change logging behavior
env NODE_ENV=production
env PORT=8000
# These parameter are used to determine how to execute the app
env APP_DIR="/mybin/CasaC/rf433-to-rest"
env NODE_APP="index.js"
env NODE_EXEC="/usr/local/bin/node"
# When to start the service
start on started xbmc-done
# When to stop the service
stop on runlevel [016] # i.e. stop on shutdown, when switching to single-user mode and on reboot
# Prepare the environment
pre-start script
mkdir -p "$VAR_DIR"
end script
# If the process quits unexpectedly trigger a respawn
respawn
respawn limit 10 5
# Start the process (this is enough for handling stop)
script
exec start-stop-daemon --make-pidfile --pidfile "$VAR_DIR/app.pid" --chuid root --chdir "$APP_DIR" --startas "$NODE_EXEC" --start -- "$APP_DIR/$NODE_APP" >> "$VAR_DIR/console.log" 2>&1
end script