-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebian_meshblu.conf
43 lines (39 loc) · 936 Bytes
/
debian_meshblu.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
40
41
42
43
#!/bin/sh
#/etc/init.d/meshblu
### BEGIN INIT INFO
# Provides: meshblu
# Required-Start: mongod
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Meshblu - the message server for all sysvinit configuration
### END INIT INFO
case "$1" in
start)
# always try to rotate logs
for file in /opt/blu/log/*.log;
do
if [ -z "$file" ]; then
mv -nv -- "$file" "$file.$(date +%Y%m%d_%H%M%S.txt)"
fi
done
sleep 45
exec forever --sourceDir /opt/blu/meshblu \
start -a -l /opt/blu/log/meshblu.log \
-o /opt/blu/log/meshblu.stdout.log \
-e /opt/blu/log/meshblu.stderr.log \
--uid "meshblu" \
-c /usr/bin/node server.js --http --coap --mqtt
;;
stop)
exec forever stop meshblu
;;
status)
exec forever list
;;
*)
echo "Usage: /etc/init.d/meshblu {start|stop|status}"
exit 1
;;
esac
exit 0