반응형

Study/Linux 12

limits.conf 및 ulimit 값이 적용되지 않을 때

서버 운영 중 ssh 접속 시 limits.conf 파일 또는 ulimit 설정으로 open files 등을 수정하였으나, 적용되지 않을 때가 있다. ssh 버전에 따라 기본값이 달라서 인데, 일부버전 이상부터는 UsePAM 이 no 로 설정된다. UsePAM 을 yes 로 설정 후 재로그인 시 limits.conf 또는 ulimit 설정 값이 적용된다. 다른 계정 로그인 후 su 로 로그인 시 limits.conf 값이 적용되나, ssh로 재로그인 시 open files 값이 자꾸 초기화 되어서 확인 결과 sshd_config 값의 문제였다. 파일 위치는 대게 /etc/ssh/sshd_config 로 설정되어있으나, 간혹 상위 버전 설치를 위해 추가로 설치한 경우는 그 설치한 경로의 etc/sshd_c..

Study/Linux 2021.03.10

[시간동기화] rdate, ntp

참조: gracefulprograming.tistory.com/104 [Linux] ntpdate로 시간동기화 하기 개요 ntpdate 명령어는 리눅스의 시간을 timeserver와 동기화하는 명령어입니다. 리눅스는 서버로 운영되는 경우가 많은데 서버 시간은 서버에서 동작하는 여러 서비스에 영향을 주게 되기 때문에 gracefulprograming.tistory.com rdate -s timeserver ntpdate timeserver # timeserver 목록 time.bora.net time.nuri.net time.windows.com ntp.kornet.net time.nist.gov # ntp 서버 설정 설정 파일 위치 /etc/ntp/ntp.conf 또는 /etc/ntp.conf 인 경우가..

Study/Linux 2021.01.11

Process Thread 확인

[참조]http://hotpotato.tistory.com/428http://myblog.opendocs.co.kr/archives/529[참조] 1. Process 확인 > ps -ef | grep 프로세스명 2. Thread 확인 > ps -efT | grep 프로세스명 # ps 명령어 옵션 #– e or A : 모든 프로세스 선택– f or F : 보여질 수 있는 모든 정보 출력- H : thread를 process 처럼 보여준다.- L : thread를 보여준다. LWP (Thread ID) / NLWP (Number of Threads) 출력- T : thread를 보여준다. SPID 출력 (SPID = LWP, TID)- m : process 다음에 thread를 보여준다. # 출력 내용 #U..

Study/Linux 2016.08.04

File Descriptor 확인 및 설정

출처 : http://www.ischo.net/board_linux/16077 현재 실행 중인 프로세스의 File Descriptor 개수 확인 ls /proc/프로세스ID(PID)/fd/ | wc -l 1. 현재의 Open 가능한 Maximum 파일 개수 확인 cat /proc/sys/fs/file-max -> 일반유저가 1개의 세션에서 열 수 있는 파일 개수 File Descriptor 는 hard, soft 값으로 나뉜다. 2. 전체 시스템에 적용되는 FD limit 값 시스템을 통해 Open 가능한 File Descriptor 개수는 /etc/sysctl.conf 파일로 변경 가능. -> 오라클 및 아파치 등의 프로세스에서 이 값을 많이 요구 # sysctl -w fs.file-max=655360..

Study/Linux 2016.03.31

java Socket error

출처 : http://www.jaso.co.kr/181 - java.net.SocketException: Connection reset by peer: socket write error 원인: write 시 상대방 socket close 된 경우 - java.net.SocketException: Connection reset 원인: read 시 상대방 socket close 된 경우 - java.io.IOException: Broken pipe 원인: receiver에서 송신받은 데이터를 제때 처리하지 못하는 상황(네트워크가 느리거나 서버의 CPU가 max인 경우 등)에서 sender가 계속 보내는 경우 결론적으로 위의 두 종류의 Exception은 데이터를 요청한 측(브라우저 등)에서 서버에서 데이터를..

Study/Linux 2016.03.31

shell script 를 이용한 ssh/sftp 자동 로그인

출처 : https://kldp.org/node/84757 A 서버에서 파일을 B서버로 전송하기 또는 전송받기 위해 sftp 자동 로그인이 필요하다.shell script 를 이용해 배치 프로세스로 생성할 계획이다. 1. A 서버 user1 로그인 2. A 서버 유저 홈에서 (/home/user1) ssh-keygen 명령 실행ssh-keygen -t rsaGenerating public/private rsa key pair.Enter file in which to save the key (/home/user1/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification ha..

Study/Linux 2016.03.25

shell script date function

출처 : http://uple.net/132 NowDate=`date`echo $NowDate [실행결과]2010년 4월 8일 목요일 오후 01시 49분 21초 DATE_YYYYMM=`date '+%Y%m'` echo $DATE_YYYYMM [실행결과]201004 DATE_YYYYMMDD=`date '+%Y%m%d'`echo $DATE_YYYYMMDD [실행결과]20100408 PREV_1DAY_YYYYMMDD=`TZ=KST+15 date '+%Y%m%d'`echo $PREV_1DAY_YYYYMMDD [실행결과]20100407 PREV_2DAY_YYYYMMDD=`TZ=KST+39 date '+%Y%m%d'`echo $PREV_2DAY_YYYYMMDD [실행결과]20100406 NOW_HOUR_MINUTE..

Study/Linux 2014.03.10

shell script find command

출처 : http://soul.tistory.com/24find : 찾기 명령 . : 은 현재 디렉 아래로-uid : UID 패턴검색옵션591 : UID 값이 591인 파일 찾기-exec : 실행하라 는 명령어chown apache:apache : 실행할 명령{} : find 로 검색하여 나온 결과값을 exec 로 실행한 명령어의 대상으로\; : find 에서 -exec 옵션으로 실행할 명령의 끝을 나타냄 ex )find / -name '[a,b][c,d]* -printfind / -perm +2 ! -type l -print -exec chmod o-w {}; find . -type f -name *.txt -exec grep "찾을문자열" {} \; -print 2014.03.27 추가 find 해서..

Study/Linux 2014.03.07