#!/bin/bash dotnet_version='net6.0' salimax_ip="$1" username='ie-entwicklung' root_password='Salimax4x25' set -e echo -e "\n============================ Build ============================\n" dotnet publish \ ./SaliMax.csproj \ -p:PublishTrimmed=false \ -c Release \ -r linux-x64 echo -e "\n============================ Deploy ============================\n" #ip_addresses=("10.2.3.115" "10.2.3.104" "10.2.4.29" "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.211") #ip_addresses=("10.2.4.154" "10.2.4.29") ip_addresses=("10.2.3.115" "10.2.3.104" "10.2.4.29" "10.2.4.33" "10.2.4.32" "10.2.4.36" "10.2.4.35" "10.2.4.154" ) for ip_address in "${ip_addresses[@]}"; do rsync -v \ --exclude '*.pdb' \ ./bin/Release/$dotnet_version/linux-x64/publish/* \ $username@"$ip_address":~/salimax ssh "$username"@"$ip_address" "cd salimax && echo '$root_password' | sudo -S ./restart" echo "Deployed and ran commands on $ip_address" done