expect를 사용하여, 입력받은 원격 서버에 파일 전송 및 명령어 실행하는 예제입니다. root 계정 및 PASSWORD 값을 변경해서 사용하면 됩니다. #!/usr/bin/expect -f if($argc < 1){ send_user "Usage: get.exp [server]\n" exit } set server [lindex $argv 0] spawn scp test.txt root@${server}:/root/test.txt spawn ssh root@${server} "cat /root/test.txt" expect { -re ".*es.*o.*" { exp_send "yes\r" exp_continue } -re ".*sword.*" { exp_send "PASSWORD\r" } } inte..
* 백업123456789ssh root@백업대상서버 "tar 2>/dev/null -cpf - / \ --exclude=/lost+found \ --exclude=/mnt \ --exclude=/proc \ --exclude=/srv \ --exclude=/sys \ --exclude=/tmp \ --exclude=/boot" \ | cat > 백업대상서버_$(date +%Y-%m-%d).tarcs * 복원1cat 백업대상서버_2017-02-22.tar | ssh user@host "tar xf - -C /"cs
- Total
- Today
- Yesterday
- monitoring
- RESTful
- 예제
- client
- check
- Linux
- apache
- 이슈처리
- httpd
- command
- deview
- 코드
- 외부링크
- Ansible
- error
- Web
- Python
- engineering
- limits
- MariaDB
- 번역
- Windows
- example
- mysql
- 명령어
- PowerShell
- code
- File
- configuration
- Module
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 |