forked from jeedom/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjeedom
More file actions
85 lines (69 loc) · 2.74 KB
/
Copy pathjeedom
File metadata and controls
85 lines (69 loc) · 2.74 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh
# This file is part of Jeedom.
#
# Jeedom is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Jeedom is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Jeedom. If not, see <http://www.gnu.org/licenses/>.
### BEGIN INIT INFO
# Provides: jeedom
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Should-Start: $NetworkManager
# Should-Stop: $NetworkManager
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts instance of jeedom
# Description: starts instance of jeedom using start-stop-daemon
### END INIT INFO
PATH_TO_JEEDOM="/usr/share/nginx/www/jeedom"
DAEMONUSER="www-data" #utilisateur du programme
####################NODE JS###################################
NODE_JS_DAEMON="/usr/bin/nodejs" #ligne de commande du programme
NODE_JS_DEAMON_OPT=$PATH_TO_JEEDOM/core/nodeJS/server.js #argument à utiliser par le programme
NODE_JS_DEAMON_NAME="nodejs" #Nom du programme (doit être identique à l'exécutable)
PATH="/sbin:/bin:/usr/sbin:/usr/bin" #Ne pas toucher
#test -x $NODE_JS_DAEMON || exit 0
#test -x $XPL_DAEMON || exit 0
. /lib/lsb/init-functions
d_start () {
log_daemon_msg "Starting system $NODE_JS_DEAMON_NAME Daemon"
start-stop-daemon --background --name $NODE_JS_DEAMON_NAME --start --quiet --user $DAEMONUSER --exec $NODE_JS_DAEMON -- $NODE_JS_DEAMON_OPT
log_end_msg $?
}
d_stop () {
log_daemon_msg "Stopping system $NODE_JS_DEAMON_NAME Daemon"
start-stop-daemon --name $NODE_JS_DEAMON_NAME --stop --retry 5 --quiet
log_end_msg $?
}
case "$1" in
start|stop)
d_${1}
;;
restart|reload|force-reload)
d_stop
d_start
;;
force-stop)
d_stop
killall -q $NODE_JS_DEAMON_NAME || true
sleep 2
killall -q -9 $NODE_JS_DEAMON_NAME || true
;;
status)
status_of_proc "$NODE_JS_DEAMON_NAME" "$NODE_JS_DAEMON" "system-wide $NODE_JS_DEAMON_NAME" && exit 0 || exit $?
;;
*)
echo "Usage: service jeedom {start|stop|force-stop|restart|reload|force-reload|status}"
exit 1
;;
esac
exit 0