update all monitored cerbo with new flows.json

This commit is contained in:
Yinyin Liu 2024-08-09 14:29:47 +02:00
parent 7c912fc8a0
commit 6e82d3536d
1 changed files with 19 additions and 32 deletions

View File

@ -9,41 +9,28 @@ battery_file_path="./CerboReleaseFiles/dbus-fzsonick-48tl"
cerbo_release_file_path="./CerboReleaseFiles" cerbo_release_file_path="./CerboReleaseFiles"
echo -e "\n============================ Deploy ============================\n" echo -e "\n============================ Deploy ============================\n"
# Polycom 10.2.4.96 are Cerbo with fork usb0 # Polycom 10.2.4.96 are Cerbo with fork usb0
ip_addresses_usb0=("10.2.2.118" "10.2.4.155" "10.2.3.244" "10.2.4.127" "10.2.2.248" "10.2.2.36")
ip_addresses_usb1=("10.2.0.179" "10.2.1.241" "10.2.1.193" "10.2.2.61" "10.2.3.225")
ip_addresses=("10.2.1.193" "10.2.2.61" "10.2.3.225" "10.2.2.248" "10.2.2.194" "10.2.1.241" "10.2.2.87" "10.2.1.252" "10.2.1.215" "10.2.1.234" \
"10.2.2.117" "10.2.3.117" "10.2.4.129" "10.2.3.10" "10.2.2.238" "10.2.2.44" "10.2.2.196" "10.2.2.24" "10.2.4.181" "10.2.3.67" \
"10.2.2.127" "10.2.3.18" "10.2.2.118" "10.2.3.46" "10.2.3.61" "10.2.2.133" "10.2.4.42" "10.2.2.217" "10.2.3.143" "10.2.2.181" "10.2.1.204" "10.2.2.171" \
"10.2.2.176" "10.2.2.218" "10.2.2.36" "10.2.4.92" "10.2.4.25" "10.2.3.135" "10.2.3.165" "10.2.3.51" "10.2.3.244" "10.2.0.179" "10.2.2.10" \
"10.2.4.155" "10.2.4.127" "10.2.5.5" "10.2.4.206")
for ip_address in "${ip_addresses_usb0[@]}"; do ## scp template
# ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./stop-tty.sh ttyUSB0"
ssh "$username"@"$ip_address" "svc -d /service/aggregator"
scp "${battery_file_path}/aggregator.py" "root@"$ip_address":/data/dbus-fzsonick-48tl/"
scp "${battery_file_path}/aggregator.py" "root@"$ip_address":/opt/victronenergy/dbus-fzsonick-48tl"
ssh "$username"@"$ip_address" "svc -u /service/aggregator"
# scp "${battery_file_path}/start.sh" "root@"$ip_address":/data/dbus-fzsonick-48tl/" # scp "${battery_file_path}/start.sh" "root@"$ip_address":/data/dbus-fzsonick-48tl/"
# scp "${cerbo_release_file_path}/rc.local" "root@"$ip_address":/data" # scp "${cerbo_release_file_path}/rc.local" "root@"$ip_address":/data"
# scp -r "${cerbo_release_file_path}/aggregator" "root@"$ip_address":/data" # scp -r "${cerbo_release_file_path}/aggregator" "root@"$ip_address":/data"
# ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./start-tty.sh ttyUSB0" for ip_address in "${ip_addresses[@]}"; do
## build connection first
ssh "$username"@"$ip_address" "echo '$root_password'"
echo "Deployed and ran commands on $ip_address" ## stop battery service if change any file related to battery service otherwise no need to do this
done # ssh "$username"@"$ip_address" "svc -d /service/dbus-fzsonick-48tl.*"
scp "${cerbo_release_file_path}/flows.json" "root@"$ip_address":/data/home/nodered/.node-red/"
for ip_address in "${ip_addresses_usb1[@]}"; do ssh "$username"@"$ip_address" "dbus -y com.victronenergy.platform /Services/NodeRed/Mode SetValue %0"
ssh "$username"@"$ip_address" "dbus -y com.victronenergy.platform /Services/NodeRed/Mode SetValue %1"
# ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./stop-tty.sh ttyUSB1" ## start battery service
# ssh "$username"@"$ip_address" "svc -u /service/dbus-fzsonick-48tl.*"
ssh "$username"@"$ip_address" "svc -d /service/aggregator"
scp "${battery_file_path}/aggregator.py" "root@"$ip_address":/data/dbus-fzsonick-48tl/"
scp "${battery_file_path}/aggregator.py" "root@"$ip_address":/opt/victronenergy/dbus-fzsonick-48tl"
ssh "$username"@"$ip_address" "svc -u /service/aggregator"
# scp "${battery_file_path}/start.sh" "root@"$ip_address":/data/dbus-fzsonick-48tl/"
# scp "${cerbo_release_file_path}/rc.local" "root@"$ip_address":/data"
# scp -r "${cerbo_release_file_path}/aggregator" "root@"$ip_address":/data"
# ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./start-tty.sh ttyUSB1"
echo "Deployed and ran commands on $ip_address" echo "Deployed and ran commands on $ip_address"
done done