I have two scripts. Both scripts are on the same server (serverA)
The first one (serverA) makes an ssh connection to the other server (serverB), and executes the second script,
e.g
*script1*
ssh $ipaddress var="$var1" "bash -s" < $script2
script2 then executes on serverB.
Is there a way to combine these into one script? So it would start by making the ssh connection, then execute the rest of the script, something like:
#!/bin/bash
#Make an SSH Connection to another server
ssh $ipaddress
#Now Execute the rest of the script
do stuff here . . .
and here . . .