본문 바로가기

Programming Practice/Server Management

Shell 기타

1. 현재 시각 기준 1분전 시각을 변수에 설정하기

ONE_MINUTE_AGO = $(perl -e 'USE POSIX;print strftime "%Y-%m-%d %H:%M", localtime time-60;)


2. unix 명령어 결과를 변수에 설정 (홑따옴표 '' 사용X, 키보드 왼쪽 최상단의 `` 을 사용)

CLOSE_CNT = `grep "test" 위치`


3. process 가 기동 중일 때 0이 아닌 값 return 하게 하기 : PID를 return한다.

ps -ef | grep -v grep | grep process명 | awk '{print $2}' | head -1




'Programming Practice > Server Management' 카테고리의 다른 글

symbolic link  (0) 2016.08.04