I Have shell script with few functions. I need to run this on 2 different machines for n
number of times. Can I call the function as mentioned below and execute it? Or is there any other way to do it?
#!/usr/bash
execCommand () {
#few statements here
}
getStatus() {
#few statements here
}
main () {
execCommand
getStatus
}
$machine1="machine1"
$machine2="machine2"
$user="username"
$n=2
while [$n -le 2]
do
ssh $user@$machine1 'main'
sleep 100
ssh $user@$machine2 'main'
n=$n+1
done