I have a VM and need to run a script remotely in another VM, for example:
Script is in VM X and must be executed by X in VM Y.
#!/bin/bash
IP=$1
if [ $# -ne 1 ]; then
echo "informe o servidor $1: "
exit
fi
for machine in $1; do
ssh -l root -o ConnectTimeout=2 $machine ifconfig
done
This command runs correctly and that's what I need, but I need to run a function with a business rule.
Looks like this:
for machine in $1; do
ssh -l root -o ConnectTimeout=2 $machine funcao1
done
function funcao1{
mkdir teste
cd teste
}
Does anyone know of a similar solution? Or similar?
Vlw !!!!