30 lines
1.1 KiB
Bash
Executable File
30 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
dotnet_version='net6.0'
|
|
salimax_ip="$1"
|
|
username='ie-entwicklung'
|
|
root_password='Salimax4x25'
|
|
|
|
set -e
|
|
|
|
ip_addresses=("10.2.3.115" "10.2.3.104" "10.2.4.33" "10.2.4.32" "10.2.4.36" "10.2.4.35" "10.2.4.154" "10.2.4.113" "10.2.4.29")
|
|
battery_ids=("2" "3" "4" "5" "6" "7" "8" "9" "10" "11")
|
|
|
|
|
|
for ip_address in "${ip_addresses[@]}"; do
|
|
scp upload-bms-firmware AF0A.bin "$username"@"$ip_address":/home/"$username"
|
|
ssh "$username"@"$ip_address" "echo '$root_password' | sudo -S systemctl stop battery.service"
|
|
ssh "$username"@"$ip_address" "echo '$root_password' | sudo -S apt install python3-pip -y"
|
|
ssh "$username"@"$ip_address" "echo '$root_password' | sudo -S pip3 install pymodbus"
|
|
|
|
for battery in "${battery_ids[@]}"; do
|
|
ssh "$username"@"$ip_address" "echo '$root_password' | sudo -S python3 upload-bms-firmware ttyUSB0 " "$battery" " AF0A.bin"
|
|
done
|
|
ssh "$username"@"$ip_address" "echo '$root_password' | sudo -S systemctl start battery.service"
|
|
ssh "$username"@"$ip_address" "echo '$root_password' | sudo -S systemctl rm upload-bms-firmware AF0A.bin"
|
|
|
|
echo "Deployed and ran commands on $ip_address"
|
|
done
|
|
|
|
|