It's my first time to write English article in this blog.
I am going to share my program that can be executed on several linux machine.
Long time ago, I wanted to execute for date command on the linux system that we manage.
I accessed a linux machine repeatedly.
It was difficult for me to do it.
So, I made a program blow.
cmd.sh
#!/bin/sh
if [ $# -lt 2 ]
then
echo "Usage : $0 {명령어} {서버리스트파일}"
exit 1
fi
servers=`cat $2`
for ip in $servers
do
echo "-------------------------------------------------"
echo "ssh ${ip} $1"
echo "-------------------------------------------------"
ssh ${ip} "$1"
echo "\n"
done
servers 파일
nklee@172.19.136.18
nklee@172.19.136.18
nklee@172.19.136.18
This program is simple and easy to use.
You can use following UNIX command.
1 | $ ./cmd.sh hostname servers | cs |
Thank you for reading this article.
'프로그래밍' 카테고리의 다른 글
[spring boot 2.1] 애노테이션 정리 (0) | 2019.08.05 |
---|---|
티스토리 API 연동 (1) | 2018.09.18 |
SCP command 프로그램 (0) | 2018.05.17 |
3. Spring Cloud를 이용한 MSA 구축하기 - config client (0) | 2018.05.15 |
spring boot swagger2 사용하기 (0) | 2018.02.01 |
16. [JPA] Bulk Insert (0) | 2017.12.14 |
15. [JPA] Spring Data JPA (0) | 2017.12.14 |
20. [JPA] lombok 사용 시 주의사항 (0) | 2017.11.28 |