启动Node-Red silent

时间:2017-03-18 22:59:51

标签: bash node-red

我想通过脚本以不同的设置启动节点红色两次。

#!/bin/bash

echo "Starte Server 1" 
node-red -s /home/a/.node-red/settings.js

echo "Starte Server 2" 
node-red -s /home/a/.node-red/settings2.js

如何像后台服务一样启动节点红色静音?

2 个答案:

答案 0 :(得分:0)

我不知道node-red是什么,但我认为它是一个javascript解释器并且它的调用是成功的。

在后台启动多项内容:

#!/bin/bash

# You don't actually need this, but its nice to have
die() {
    echo "$@" 1>&2
    exit 1
}

# List of all your settings
settings_files=( \
    "/home/a/.node-red/settings.js" \
    "/home/a/.node-red/settings2.js" \
)

# function to start node red plus extra output
# about whether or not that succeeded
launch_node_red() {
    settings_file="$1"
    echo "Starting node-red with settings file: $settings_file"
    node-red -s "$settings_file" || \
        die "Could not start node-red with $settings_file"
}

# for each of the settings files, start node red with
# that file and run it in the background
for settings_file in ${settings_files[@]}; do
    launch_node_red "$settings_file" &
done

# Comment this out if you want the current script to
# just return to the shell.
wait # for the servers to exit

答案 1 :(得分:0)

您可以使用(&)&进行后台处理。

#!/bin/bash

echo "Starte Server 1" 
(node-red -s /home/a/.node-red/settings.js &)&

echo "Starte Server 2" 
(node-red -s /home/a/.node-red/settings2.js &)&

或者您可以使用nohub或screen命令在后台启动节点红色并对其进行监控