-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy path4.Document-multiple-cmds-on-multiple-servers.txt
More file actions
28 lines (24 loc) · 1.12 KB
/
4.Document-multiple-cmds-on-multiple-servers.txt
File metadata and controls
28 lines (24 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
<< my_com
echo "The date command output on the server: 100.26.187.33"
sshpass -f pass ssh -o StrictHostKeyChecking=No automation@100.26.187.33 "date"
echo "-------------------------------------------------------"
echo "The uptime command output on the server: 100.26.187.33"
sshpass -f pass ssh -o StrictHostKeyChecking=No automation@100.26.187.33 "uptime"
echo "-------------------------------------------------------"
echo "The free -m command output on the server: 100.26.187.33"
sshpass -f pass ssh -o StrictHostKeyChecking=No automation@100.26.187.33 "free -m"
echo "-------------------------------------------------------"
my_com
for each_ser in $(cat remote_servers.txt)
do
echo "Executing cmds on $each_ser"
echo "============================"
for each_cmd in date uptime "free -m"
do
echo "The $each_md command output on the server: $each_ser"
#sshpass -f pass ssh -o StrictHostKeyChecking=No automation@$each_ser "$each_cmd"
ssh -o StrictHostKeyChecking=No automation@$each_ser "$each_cmd"
echo "-------------------------------------------------------"
done
done