#!/bin/bash
LOG_DIR=log-`date +%Y.%m.%d_%H.%M.%S`
mkdir -p $LOG_DIR
scp -C ec2-user@node1.server.com:/log/file.log $LOG_DIR/file1.log
scp -C ec2-user@node2.server.com:/log/file.log $LOG_DIR/file2.log
scp -C ec2-user@node3.server.com:/log/file.log $LOG_DIR/file3.log
cat $LOG_DIR/*.log | sort >$LOG_DIR/files.log
Also it is a good idea to use ssh-agent to keep private keys.
No comments:
Post a Comment