update all monitored venus with new controller.py

This commit is contained in:
Yinyin Liu 2024-08-09 15:10:13 +02:00
parent 28039e9149
commit 2d3af976c1
1 changed files with 23 additions and 40 deletions

View File

@ -9,49 +9,32 @@ battery_file_path="./VenusReleaseFiles/dbus-fzsonick-48tl"
venus_release_file_path="./VenusReleaseFiles"
echo -e "\n============================ Deploy ============================\n"
# Polycom 10.2.4.96 are Cerbo with fork usb0
# Grundmann 10.2.0.155 failed with ssh"
# Wiest 10.2.0.209 failed with ssh"
# Buecheler 10.2.0.224 failed with ssh"
ip_addresses_usb0=("10.2.1.97" "10.2.0.104" "10.2.1.159" "10.2.0.227" "10.2.4.96")
ip_addresses_usb1=("10.2.1.35" "10.2.0.211")
# Grundmann 10.2.0.155 failed with ssh
# Wiest 10.2.0.209 failed with ssh
# Buecheler 10.2.0.224 failed with ssh
# Steiger, Rheinau 10.2.0.188 failed with ssh
ip_addresses=("10.2.0.104" "10.2.1.134" "10.2.0.130" "10.2.1.169" "10.2.1.159" "10.2.0.227" "10.2.0.211" "10.2.0.105" "10.2.0.225" "10.2.1.53" "10.2.0.107" \
"10.2.0.108" "10.2.1.160" "10.2.0.98" "10.2.0.94" "10.2.1.110" "10.2.0.220" "10.2.0.153" "10.2.1.106" "10.2.0.184" "10.2.1.60" "10.2.0.217" "10.2.1.81" "10.2.1.125" \
"10.2.0.154" "10.2.0.196" "10.2.1.84" "10.2.0.99" "10.2.0.109" "10.2.1.35" "10.2.0.110" "10.2.1.2" "10.2.1.163" "10.2.1.120" "10.2.1.173" "10.2.0.113" "10.2.0.233" \
"10.2.1.124" "10.2.0.193" "10.2.1.142" "10.2.1.141" "10.2.1.74" "10.2.0.141" "10.2.0.144" "10.2.0.138" "10.2.1.118" "10.2.0.133" "10.2.0.249" "10.2.1.33" "10.2.1.38" \
"10.2.0.185" "10.2.1.130" "10.2.0.194" "10.2.1.39" "10.2.1.83" "10.2.0.214" "10.2.1.219" "10.2.0.191" "10.2.0.216" "10.2.1.113" "10.2.0.103" "10.2.1.32" "10.2.1.100" \
"10.2.1.138" "10.2.1.165" "10.2.1.162" "10.2.0.150" "10.2.1.158" "10.2.0.195" "10.2.1.171" "10.2.1.117" "10.2.0.145" "10.2.1.177" "10.2.1.247" "10.2.0.101")
for ip_address in "${ip_addresses_usb0[@]}"; do
# 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}/service/run" "root@"$ip_address":/data/dbus-fzsonick-48tl/service"
# scp "${venus_release_file_path}/rc.local" "root@"$ip_address":/data"
# scp -r "${venus_release_file_path}/aggregator" "root@"$ip_address":/data"
# ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./start-tty.sh ttyUSB0"
echo "Deployed and ran commands on $ip_address"
done
for ip_address in "${ip_addresses_usb1[@]}"; do
# ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./stop-tty.sh ttyUSB1"
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}/service/run" "root@"$ip_address":/data/dbus-fzsonick-48tl/service"
# scp "${venus_release_file_path}/rc.local" "root@"$ip_address":/data"
# scp -r "${venus_release_file_path}/aggregator" "root@"$ip_address":/data"
# ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./start-tty.sh ttyUSB1"
## scp template
# scp "${battery_file_path}/start.sh" "root@"$ip_address":/data/dbus-fzsonick-48tl/"
# scp "${venus_release_file_path}/rc.local" "root@"$ip_address":/data"
# scp -r "${venus_release_file_path}/aggregator" "root@"$ip_address":/data"
for ip_address in "${ip_addresses[@]}"; do
## stop battery service if change any file related to battery service otherwise no need to do this
# ssh -o StrictHostKeyChecking=no "$username"@"$ip_address" "svc -d /service/dbus-fzsonick-48tl.*"
ssh -o StrictHostKeyChecking=no "$username"@"$ip_address" "svc -d /service/controller"
scp "${venus_release_file_path}/controller.py" "root@"$ip_address":/data"
scp "${venus_release_file_path}/controller.py" "root@"$ip_address":/opt/innovenergy/controller"
ssh -o StrictHostKeyChecking=no "$username"@"$ip_address" "svc -u /service/controller"
## start battery service
# ssh -o StrictHostKeyChecking=no "$username"@"$ip_address" "svc -u /service/dbus-fzsonick-48tl.*"
echo "Deployed and ran commands on $ip_address"
done