2017-03-18 47 views
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 

如何啓動節點 - 紅色沉​​默像後臺服務?

回答

0

我不知道node-red是什麼,但我會認爲它是一個JavaScript解釋器,它的調用是成功的。

要啓動多件事情的背景:

#!/bin/bash 

# You don't actually need this, but its nice to have 
die() { 
    echo "[email protected]" 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

這就像一個魅力!非常感謝你! – sdkrwl

+0

(node-red是一款面向物聯網的IBM原型開發工具,目前也在某些生產系統中使用,它是一個基於web的圖形化編程環境,位於express.js服務器之上,具有豐富的現成和第三方軟件,我不是IBM員工:)但它是一個有趣的工具... http://nodered.org) – sinewave440hz