scp 쓰는법

Posted by 주원이^^
2017.01.31 17:00 리눅스/소프트웨어(Software)

sftp로 사용할 경우 폴더 전체에 있는 파일을 옮기기 쉽지않다.


특히 디렉토리​에 하위 디렉토리가 있을 경우에는 스크립트를 작성하지 않는 이상 어렵다고 할 수 있다.


그래서 찾은 것이 scp 명령어이다.


정리.



서버1. XXX.XXX.XX.93 : 복사해야 할 서버


 - 복사해야할 폴더경로 : /data2/ispdata


서버2. ​XXX.XXX.XX.89 : 복사해서 넣고 싶은 서버


​  - 복사해서 넣고 싶은 폴더 경로 : /data/neos/


1. 폴더가 있는 서버에 접속한다.(175.125.91.89)


2. ​89번에서 scp 명령어를 실행한다. (물론 두 서버간에는 22번 포트가 열려 있어야 한다.)






 89번 서버에서


 root(또는 사용자계정) hostname] $ scpˇ-rvˇ/data2/ispdataˇ (이동해야 할 서버의 계정)@XXX.XXX. 


 XX.93:/data/neos/


 


 - r : 폴더를 복사한다는 옵션


 - v : 복사 과정을 보여주는 옵션 




 

scp -rv /data2/ispdata neos@XXX.XXX.XX.93:/home/ne​​​os/



'리눅스 > 소프트웨어(Software)' 카테고리의 다른 글

scp 쓰는법  (0) 2017.01.31
DNS 설치  (0) 2017.01.31
하드웨어 부하테스트 (Stress)  (0) 2016.07.13
LVS Server2  (0) 2016.04.08
LVS Server1  (0) 2016.04.08
리눅스 본딩셋팅  (0) 2015.09.14
이 댓글을 비밀 댓글로

DNS 설치

Posted by 주원이^^
2017.01.31 16:26 리눅스/소프트웨어(Software)

Chroot 를 사용하지 않는 bind 설치는 매우 쉽다.

일단 bind 를 설치한다.

yum -y install bind

그리고 각종 zone 파일 및 conf 파일을 카피한다.

cp -a /usr/share/doc/*/sample/var/named/* /var/named/

cp -a /usr/share/doc/*/sample/etc/* /var/named/

named.conf 파일을 /etc 및에 심볼릭 링크를 건다.

ln -s /var/named/named.conf /etc/named.conf

 

/etc/named.conf 파일을 수정한다.

vi /etc/named.conf

options
{
        // Those options should be used carefully because they disable port
        // randomization
        // query-source    port 53;
        // query-source-v6 port 53;

        // Put files that named is allowed to write in the data/ directory:
        directory "/var/named"; // the default
        dump-file               "data/cache_dump.db";
        statistics-file         "data/named_stats.txt";
        memstatistics-file      "data/named_mem_stats.txt";

};

zone "localdomain" IN {
        type master;
        file "localdomain.zone";
        allow-update { none; };
};

zone "localhost" IN {
        type master;
        file "localhost.zone";
        allow-update { none; };
};

zone "0.0.127.in-addr.arpa" IN {
        type master;
        file "named.local";
        allow-update { none; };
};

zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
        type master;
        file "named.ip6.local";
        allow-update { none; };
};

zone "255.in-addr.arpa" IN {
        type master;
        file "named.broadcast";
        allow-update { none; };
};

zone "0.in-addr.arpa" IN {
        type master;
        file "named.zero";
        allow-update { none; };
};

include "/etc/rndc.key";

 

named.conf 파일이 정상 작동 되는지 여부를 확인한다.

 

named-checkconf -z

에러 안나오면 끗!

 

/etc/init.d/named start

 

netstat -an | grep LISTEN

 

이젠 끝!!

 

UDP, TCP 53 Port 가 떳는지 확인해 보자

 

자동 실행 되게 chkconfig 에 등록하자

 

chkconfig --add named

chkconfig --level 2345 named on

'리눅스 > 소프트웨어(Software)' 카테고리의 다른 글

scp 쓰는법  (0) 2017.01.31
DNS 설치  (0) 2017.01.31
하드웨어 부하테스트 (Stress)  (0) 2016.07.13
LVS Server2  (0) 2016.04.08
LVS Server1  (0) 2016.04.08
리눅스 본딩셋팅  (0) 2015.09.14
이 댓글을 비밀 댓글로

system 정보보기 스크립트

Posted by 주원이^^
2017.01.31 16:21 리눅스/스크립트

###########################################################

# Name of the script : syscheck-v1.2.sh

# Date              : 07/26/98

# Modified        : 11/15/04       By Jae. Hwa, Kim

# Version : 1.2

# This script collects System Configuration information.

# tar : sysinfo, error log , hacmp snap, x25backup, sna

###########################################################

DATE=`date +%m%d%y`

SRV=`uname -n`

RPT=./sys.$SRV.$DATE.txt

X25BACK=./x25.$SRV.$DATE.txt

HASNAP=/usr/es/sbin/cluster/snapshots/snap.$SRV.$DATE.*

ERRLOG=./err.$SRV.$DATE.txt

SYSTAR=./`uname -n`.`date +%m%d%y`.check.tar

mkdir ./x25backup

echo "System information will be saved on $RPT"

#TMP="/tmp"

#> ${PRT}

exec >> ${RPT} 2>&1

# Put the server and the date in the report

banner `uname -n`

echo " "

echo "                     %%%%%%%%%%%%%%%%%%%%%%%%%%%"

echo "                     System Configuration Report"

echo "                     %%%%%%%%%%%%%%%%%%%%%%%%%%%"

echo " "

echo `date `

echo " "

# General Information.

echo "######################"

echo "General Information"

echo "######################"

echo " "

prtconf

echo " "

echo " "

echo " "

# CPU_CLOCK.

echo "######################"

echo "CPU_CLOCK"

echo "######################"

echo " "

CPU_CLOCK.exe

echo " "

echo " "

echo " "

# General OS Information.

echo "######################"

echo "General OS Information"

echo "######################"

echo " "

# Check the Operating System Level in the report

echo "=============================================="

echo "<< `uname -n` -- AIX Operating System Level >>"

echo "=============================================="

echo " "

echo "---------------------------------------"

echo "Lists names of known maintenance levels"

echo "---------------------------------------"

echo " "

/usr/bin/oslevel -q

echo " "

echo "-----------------------------------------------------------------"

echo "Lists fileset at levels later than the current maintenance levels"

echo "-----------------------------------------------------------------"

echo " "

/usr/bin/oslevel -r

echo " "

echo " "

echo "===================================="

echo "<< `uname -n` -- Boot Information >>"

echo "===================================="

echo " "

echo "--------------------"

echo "The last boot Device"

echo "--------------------"

echo " "

/usr/sbin/bootinfo -b

echo " "

echo "------------------------------------"

echo "The Booting Kernel Mode(32bit/64bit)"

echo "------------------------------------"

echo "H/W    Mode : "`/usr/sbin/bootinfo -y`" bit"

echo "Kernel Mode : "`/usr/sbin/bootinfo -K`" bit"

echo " "

echo "-----------------"

echo "The System uptime"

echo "-----------------"

uptime

echo " "

echo " "


# Put the system attributes in the report

echo "======================================================================="

echo "<< `uname -n` -- System Attribute information (lsattr -E -H -l sys0) >>"

echo "======================================================================="

echo " "

lsattr -E -H -l sys0

echo " "

# Put the machinetype info in the report

echo "=============================================="

echo "<< `uname -n` -- System Information (lscfg) >>"

echo "=============================================="

echo " "

lscfg -vp

echo " "

# Print the Processor on this server

echo "========================================="

echo "<< `uname -n` -- Processor information >>"

echo "========================================="

echo " "

/usr/sbin/bindprocessor -q

echo " "

# Print the amount of memory on this server

echo "======================================"

echo "<< `uname -n` -- Memory information >>"

echo "======================================"

echo " "

echo "-----------------------"

echo "The Size of real memory"

echo "-----------------------"

echo " "

/usr/sbin/bootinfo -r

echo " "

# Put the OS-dump info in the report

echo "===================================="

echo "<< `uname -n` -- DUMP information >>"

echo "===================================="

echo " "

echo "-------------------"

echo "Current Dump Device"

echo "-------------------"

echo " "

sysdumpdev -l

echo " "

echo "--------------------"

echo " Estimated Dump Size"

echo "--------------------"

echo " "

sysdumpdev -e

echo " "

# Put the OS-page space info in the report

echo "========================================="

echo "<< `uname -n` -- Paging space information"

echo "========================================="

echo " "

lsps -a

echo " "

echo "======================================="

echo "<< `uname -n` -- Disk Usage Information"

echo "======================================="

echo " "

df -tk

echo " "

echo "======================================="

echo "<< `uname -n` -- Slot Information"

echo "======================================="

echo " "

lsslot -c pci

echo " "

# Print physical scsi adapter and disk info

echo "======================================================="

echo "<< `uname -n` -- SCSI adapter and physical disk info >>"

echo "======================================================="

echo " "

lscfg | grep -i scsi | grep -i -E "adapter|controller"

echo " "

lsdev -Cc disk

echo " "

echo "======================================="

echo "<< `uname -n` -- Crontab Information >>"

echo "======================================="

echo " "

crontab -l

echo " "

echo "==============================================="

echo "<< `uname -n` -- File System export Information"

echo "==============================================="

echo " "

exportfs

echo " "

echo "========================================="

echo "<< `uname -n` -- Alog Boot Information >>"

echo "========================================="

echo " "

echo " "

alog -o -f /var/adm/ras/bootlog

echo " "

echo " "

echo " "

echo " "

echo "========================================="

echo "<< `uname -n` -- User License Information"

echo "========================================="

echo " "

echo " "

lslicense

echo " "

echo " "

echo " "

echo " "

# LVM Information

echo "#################"

echo " LVM Information "

echo "#################"

echo " "

echo " "

echo " "

# List all VG

# Find all the disks in the machine then print info

echo "======================================"

echo "<< `uname -n` -- List all volume group"

echo "======================================"

echo " "

echo "-------------"

echo "Volume Groups"

echo "-------------"

echo " "

echo "List Volume Group"

lsvg

echo " "

echo "List On-line Volume Group"

echo " "

lsvg -o

echo " "

echo "----------------"

echo "Physical Volumes"

echo "----------------"

lspv

echo " "

echo " "

echo " "

lsvg | while read VG

do

 echo " "

 echo "The following physical volumes are in Volume Group -- $VG --"

 lsvg -p $VG

 echo " "

 echo "<< Volume group info for $VG"

 lsvg $VG

 echo " "

 echo " "

 echo " "

done

echo " "

# List physical disk info

echo "=========================================================="

echo "<< `uname -n` -- List all physical volumes by volume group"

echo "=========================================================="

echo " "

getlvodm -C | while read VOL

do

 echo " "

 echo "<< Physical volume info for $VOL by PVID >>"

 lspv $VOL

 echo " "

 echo "<< Physical volume info for $VOL by logical volume >>"

 lspv -l $VOL

 echo " "

 echo "<< Physical volume info for $VOL by PP Range >>"

 lspv -p $VOL

 echo " "

 echo " "

 echo " "

done

echo " "

# List all logical volumes by volume group

echo "========================================================="

echo "<< `uname -n` -- List all logical volumes by volume group"

echo "========================================================="

echo " "

lsvg -o | while read VG

do

 echo "<< List of logical volumes defined in volume group $VG >>"

 lsvg -l $VG

 echo " "

 echo "<< List of physical volumes defined in volume group $VG >>"

 lsvg -p $VG

 echo " "

 echo " "

 echo " "

done

echo " "

# Save the mount information in the report

echo "====================================="

echo "<< `uname -n` -- Mount information >>"

echo "====================================="

echo " "

mount

echo " "

# Print the file system information

echo "========================================="

echo "<< `uname -n` -- List all file systems >>"

echo "========================================="

echo " "

lsfs -l

echo " "

# Network Information

echo "###################"

echo "Network Information"

echo "###################"

echo " "

echo " "

# Check Network Option

echo "================================================="

echo "<< `uname -n` -- Network Option Tunable Values >>"

echo "================================================="

echo " "

echo "-------------------------------"

echo "Important Network Option Values"

echo "-------------------------------"

echo " "

no -a | grep thewall

no -a | grep sb_max

no -a | grep tcp_sendspace

no -a | grep tcp_recvspace

no -a | grep udp_sendspace

no -a | grep udp_recvspace

no -a | grep rfc1323

no -a | grep tcp_mssdflt

no -a | grep ipforwarding

no -a | grep tcp_pmtu_discover

no -a | grep udp_pmtu_discover

echo " "

echo " "

# Put the network information in the report

echo "================================================="

echo "<< `uname -n` -- Network information (netstat) >>"

echo "================================================="

echo " "

echo "-----------"

echo "netstat -nr"

echo "-----------"

netstat -nr

echo " "

echo "----------"

echo "netstat -i"

echo "----------"

netstat -i

echo " "

echo "----------"

echo "netstat -m"

echo "----------"

netstat -m

echo " "

echo "----------"

echo "netstat -v"

echo "----------"

netstat -v

echo " "


# Improtant Files

echo "###########################"

echo "Important Files Information"

echo "###########################"

echo " "

echo " "

echo " "

echo "========================================"

echo "<< `uname -n` -- some Important files >>"

echo "========================================"

echo " "

echo "------------"

echo "/etc/inittab"

echo "------------"

cat /etc/inittab

echo " "

#echo " "

echo "----------"

echo "/etc/hosts"

echo "----------"

cat /etc/hosts

echo " "

#echo " "

echo "----------------"

echo "/etc/resolv.conf"

echo "----------------"

cat /etc/resolv.conf

echo " "

#echo " "

echo "---------"

echo "/etc/motd"

echo "---------"

cat /etc/motd

echo " "

#echo " "

echo "-----------"

echo "/etc/passwd"

echo "-----------"

cat /etc/passwd

echo " "

#echo " "

echo "----------"

echo "/etc/group"

echo "----------"

cat /etc/group

echo " "

3echo " "

echo "------------"

echo "/etc/profile"

echo "------------"

cat /etc/profile

echo " "

#echo " "

echo "------------------"

echo "/etc/security/user"

echo "------------------"

cat /etc/security/user

echo " "

#echo " "

echo "--------------------"

echo "/etc/security/limits"

echo "--------------------"

cat /etc/security/limits

echo " "

#echo " "

echo "-----------------------"

echo "/etc/security/login.cfg"

echo "-----------------------"

cat /etc/security/login.cfg

echo " "

#echo " "

echo "---------------------"

echo "/etc/security/environ"

echo "---------------------"

cat /etc/security/environ

echo " "

#echo " "

echo "-------------"

echo "/etc/services"

echo "-------------"

cat /etc/services

echo " "

#echo " "

echo "----------------"

echo "/etc/filesystems"

echo "----------------"

cat /etc/filesystems

echo " "

#echo " "

echo "-----------"

echo "/etc/rc.net"

echo "-----------"

cat /etc/rc.net

echo " "

echo " "

echo " "

echo " "

echo "-----------"

echo "    aio    "

echo "-----------"

lsattr -El aio0

echo " "

echo " "

echo " "

echo " "

# List Software Installed.

echo "####################"

echo "Software Information"

echo "####################"

echo " "

# Get the LPP information

echo "==========================================================="

echo "<< `uname -n` -- List all LPPs installed on this machine >>"

echo "==========================================================="

echo " "

lslpp -L all

echo " "

echo " "

echo " "

echo " "

# SNA config & status & backup

echo "####################"

echo "SNA config & status"

echo "####################"

echo " "

echo "========================="

echo "<< `uname -n` -- SNA >>"

echo "========================="

echo "-----------------------------"

echo "<< `uname -n` -- SNA status >>"

echo "-----------------------------"

mpcinfo

echo " "

ListRAS

echo " "

sna -d l

echo " "

sna -d s

echo " "

echo "==================="

echo "SNA config Backup "

echo "==================="

cat /etc/sna/sna_node.cfg

echo " "

echo " "

# X.25 config & status & backup

echo "####################"

echo "X.25 config & status"

echo "####################"

echo " "

echo "========================="

echo "<< `uname -n` -- x.25  >>"

echo "========================="

echo "-----------------------------"

echo "<< `uname -n` -- x25status >>"

echo "-----------------------------"

x25status

echo " "

echo "-------------------------"

echo "<< `uname -n` -- lsx25 >>"

echo "-------------------------"

lsx25

echo " "

echo "==================="

echo "X.25 config Backup "

echo "==================="

backupx25 -d /x25backup -v

echo " "

echo " "

echo " "

# HACMP config & status & backup

echo "#####################"

echo "HACMP Config & status"

echo "#####################"

echo " "

echo "-----------------------------------"

echo "<< `uname -n` HACMP Daemon status >>"

echo "-----------------------------------"

echo "Cluster status"

lssrc -a |egrep 'svc|ES'

lssrc -ls snmpd

lssrc -ls topsvcs 

lssrc -ls emsvcs 

lssrc -ls emaixos

lssrc -ls grpsvcs

echo " "

echo " "

echo " "

echo "======================================"

echo "<< `uname -n` -- HACMP Information  >>"

echo "======================================"

echo "-------------------------------------"

echo "<< `uname -n` HACMP Cluster config >>"

echo "-------------------------------------"

echo "<< Cluster info >>"

/usr/es/sbin/cluster/utilities/cllsclstr

echo " "

echo "<< Cluster Node info >>"

/usr/es/sbin/cluster/utilities/cllsnode

echo " "

echo "<< Cluster Node interface info >>"

/usr/es/sbin/cluster/utilities/cllsif

echo " "

echo "<< Cluster resources group >>"

/usr/es/sbin/cluster/utilities/cllsgrp

echo " "

echo "<< Cluster resource group information >>"

/usr/es/sbin/cluster/utilities/cllsgrp  | while read REG

do

   echo "-----------------------"$REG" information-----------------------------"

   /usr/es/sbin/cluster/utilities/clshowres -g $REG

   echo " "

done

echo "------------------------------"

echo "<< `uname -n` -- HACMP SNAP >>"

echo "------------------------------"

/usr/es/sbin/cluster/utilities/clsnapshot -c -i -n snap.$SRV.$DATE  -d  'ha snap'

echo "###########################"

echo "`uname -n` system error log"

echo "###########################"

echo "--------------------------------------"

echo "<< `uname -n` -- errpt > $ERRLOG >>"

echo "--------------------------------------"

errpt >> $ERRLOG

echo "--------------------------------------"

echo "<< `uname -n` -- errpt -a >> $ERRLOG >>"

echo "--------------------------------------"

errpt -a >> $ERRLOG

echo " "

echo "==== tar compress ===="

tar cvf $SYSTAR $RPT $HASNAP ./x25backup $ERRLOG

echo "<< End of the Document for `uname -n` >>"

# End of the Script

# remove status file

rm $RPT $HASNAP $X25BACK $ERRLOG

rmdir x25backup

'리눅스 > 스크립트' 카테고리의 다른 글

mysql binlog -> sql 로 변환하기 스크립트  (0) 2017.03.24
실시간 트래픽 체크  (0) 2017.02.02
system 정보보기 스크립트  (0) 2017.01.31
ssh_bruteforce 자동차단  (0) 2016.11.04
웹 트래픽 로그 순위 추출  (0) 2016.11.03
apache 자동다운받기  (0) 2016.03.04
이 댓글을 비밀 댓글로