본문 바로가기

테크/기타42

ps 로 프로세스 찾아서 바로 kill 하기(ps, awk, xargs) ps -ef | grep 프로세스명 | awk '{ print $2 }' | xargs kill -9 2015. 8. 26.
centos7 에 postgresql9 설치하기 #Goal.- Centos 7 에 Postgresql 9 버전 설치하기.- pg 설치 디렉토리를 지정- pg DB data 디렉토리를 지정- 특정 유저 권한으로 실행(관리)하기 설치 url : http://www.postgresql.org/download/linux/redhat/ yum으로 기본 설치yum install http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-redhat94-9.4-1.noarch.rpmyum install postgresql94-server postgresql94-contrib /usr/pgsql-9.4/ 에 설치됨 -> pg 애플리케이션 관리를 위해 원하는 디렉토리로 이동시킴mv /usr/pgsql-9.4 /opt/3rd/ .. 2015. 8. 23.
[Perl] Method 내에서 전달된 hash 직접 조작하기 12345678910111213141516171819202122232425262728293031323334353637#!/usr/bin/perluse Data::Dumper; my $r_org_h = getHash();printf "%s", Dumper $r_org_h; sub getHash{ my %item = (); $item{s_item}{domain_a}{company0} = "10"; $item{s_item}{domain_a}{company1} = "11"; $item{s_item}{domain_b}{company0} = "20"; $item{s_item}{domain_b}{company1} = "21"; printf "%s", Dumper \%item; changeSiteHash(\%item).. 2015. 8. 10.
[Python] fork (자식 프로세스 생성하기) ※ 파이썬 버전 : Python 2.3.4 * 현재 프로세스의 pid 가져오기 - os.getpid() * 자식 프로세스 fork 하여 부모,자식 프로세스 판별하기 - os.fork() - 리턴값이 0이면, 자식 프로세스 - 리턴값이 0보다 크면, 부모 프로세스 * 샘플 - 부모는 두 개의 자식 프로세스를 생성하여 각 pid 값을 childs 변수에 저장한다. - 각 자식 프로세스는 5초간 수행되고 종료한다. 123456789101112131415161718192021222324252627282930313233 import osimport timeimport sys #childs = {}childs = {'$pa':'first child', '$pb':'second child'} print "main s.. 2015. 8. 4.