-
Notifications
You must be signed in to change notification settings - Fork 13
/
node-red
executable file
·38 lines (33 loc) · 872 Bytes
/
node-red
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
#!/bin/sh /etc/rc.common
# Starts and stops Node-RED
# /etc/init.d/node-red
START=90
STOP=10
HOSTNAME=$(uname -n)
export HOSTNAME
# The log is written to here - please make sure your user has write permissions.
LOG=/var/log/node-red.log
start() {
echo "Starting Node-Red..."
touch $LOG
echo "" >> $LOG
echo "Node-RED service start: "$(date) >> $LOG
node-red -u /etc/node-red flows.json >> $LOG &
echo "Logging to "$LOG
}
stop() {
echo "Stopping Node-Red..."
killall -SIGINT node-red
sleep 3
echo "" >> $LOG
echo "Node-RED service stop: "$(date) >> $LOG
}
restart() {
echo "Restarting Node-Red..."
killall -SIGINT node-red
sleep 3
rm -f $LOG && touch $LOG && echo "" >> $LOG
echo "Node-RED service restart: "$(date) >> $LOG
node-red -u /etc/node-red flows.json >> $LOG &
echo "Logging to "$LOG
}