grep 을 사용한 예제임 여러파일에서 특정문자가 포함된 글을 찾고 싶다면 grep 을 사용할 수 있다. -rw-rw-r--. 1 aaboo aaboo 15993 5월 2 18:05 log-20230501.log -rw-rw-r--. 1 aaboo aaboo 430 5월 2 18:13 log-20230502.log -rw-rw-r--. 1 aaboo aaboo 5390 5월 3 05:28 log-20230503.log -rw-rw-r--. 1 aaboo aaboo 337 5월 3 17:27 log-20230504.log 아래 코드는 log-2023* 의 … 계속 읽기 Linux 여러파일에서 특정문자가 포함된 글찾기(grep)
[카테고리:] WAS
지난 자료 자동 삭제
/app/engine/aaboo/logs/ 폴더에서 14일이 지난 *.log 파일과 *.txt 파일을 찾아서모두 삭제해 버려라 /app/engine/del14.sh #!/bin/sh LANG=C export LANG if [ -d /app/engine/aaboo/logs ];then find /app/engine/sales/logs -mtime +14 -name *\*.log -exec rm {} \; find /app/engine/sales/logs -mtime +14 -name *\*.txt -exec rm {} \; fi exit 0 매일 자동 실행 되도록 하여라 crontab -e #매일 01시 22분 마다 … 계속 읽기 지난 자료 자동 삭제
리눅스 포트 사용중인 서비스 찾기
lsof - List Open Files command: lsof -i :<port_number> COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME java 17144 bxm 84u IPv6 2794692810 0t0 TCP localhost:8012 (LISTEN) ss - Socket Statistics: ss -lntp | grep <port_number> LISTEN 0 1 ::ffff:127.0.0.1:8012 :::* users:(("java",pid=17144,fd=84)) netstat - Network Statistics: netstat -tulpn | grep <port_number> tcp6 0 0 … 계속 읽기 리눅스 포트 사용중인 서비스 찾기
WAS 쉘파일 실행 예제
TestController.java @RequestMapping(value = "/test/execShellFile",method = {RequestMethod.POST, RequestMethod.GET}) @ResponseBody public String putDeployWarGit( HttpServletRequest request, HttpServletResponse response, Model model ) { String service = request.getParameter("serviceCD"); String server = request.getParameter("serverCD"); String itemList = request.getParameter("itemlist"); DeployServerInfoInVO serInVO = new DeployServerInfoInVO(); serInVO.setServiceId(service); serInVO.setServerId(server); List<DeployServerInfoOutVO> list = proService.selectDeployServerInfoList(serInVO); JsonParser jsonParser = new JsonParser(); JsonArray itemArray = (JsonArray)jsonParser.parse(itemList); JsonObject pItem = (JsonObject) … 계속 읽기 WAS 쉘파일 실행 예제
heroku 스택 변경
히로쿠. heroku.com 이 웹사이트에서는 무료로 WAS를 사용할 수 있도록 해준다. aaboo 라는 테스트 웹을 만들어서 aaboo.herokuapp.com 으로 들어가면 볼 수 있도록 만들어 주는 것이고 git과 연동되도록 되어 있어 sourceTree로 업로드도 어렵지 않게 구현할 수 있다. 그러나... 오랜만에 heroku에 들어갔더니 위와 같은 경고창이 떴다. 내가 작업하는 앱의 저장공간이 오래되어 최신 서버로 옮기라고 경고하는 것인데... 음. 머 … 계속 읽기 heroku 스택 변경
SSH 공개키 생성
A서버(보내는서버), B서버(받는서버)가 있고A에서 B로 로그인 없이 공개키를 통해서 sftp 등으로 접속을 할 수 있다. cd ~/.ssh 보내는 서버에서 공개키 생성ssh-keygen -t rsa ll ~/.ssh-rw-r--r-- 1 aaboo aaboo 1588 2022-05-30 11:02 authorized_keys-rw-------. 1 aaboo aaboo 668 2016-07-27 10:23 id_dsa-rw-r--r--. 1 aaboo aaboo 603 2016-07-27 10:23 id_dsa.pub-rw-------. 1 aaboo aaboo 1675 2022-05-16 13:55 id_rsa-rw-r--r--. 1 aaboo aaboo … 계속 읽기 SSH 공개키 생성
Shell 7일 전에 만든 파일 삭제하기
/app/logs/aaboo 폴더에 있는 파일 중에서 7일이 지난 .log 파일이나 .txt 파일을 삭제한다. vi del_logfile.sh #!/bin/sh LANG=C export LANG if [ -d /app/logs/aaboo ]; then find /app/logs/aaboo -mtime +7 -name *\*.log -exec rm {} \; find /app/logs/aaboo -mtime +7 -name *\*.txt -exec rm {} \; fi exit 0
Tomcat server.xml appBase, docBase
apache-tomcat-8.0.33 에서 경험상 기록남겨요 appBase: 실제 소스 폴더가 위치한 경로(ROOT.war가 압축 해제되는 경로) docBase: ROOT.war 가 위치한 경로(설정 없을 경우 appBase에서 ROOT.war를 찾음) tomcat server.xml 에서 <Host name="localhost" appBase="/app/webapps/com" unpackWARs="true" autoDeplay="false"></Host> appBase 경로에는 ROOT 라는 폴더가 있어야 한다. 실제 소스 경로이다. tomcat ./conf/com/localhost/ROOT.xml 에서 <Context crossContext="true" docBase="/app/src/com/ROOT.war" path="" reloadable="true"></Context> ROOT.war의 위치를 설정하는 것이다. 위에서 appBase … 계속 읽기 Tomcat server.xml appBase, docBase
Linux 파일크기별 검색
du -ch /app --max-depth=1 | sort -hr /app 폴더 안의 1Depth까지 폴더의 크기를 확인할 수 있다. 53G /app25G /app/src23G /app/engine6.3G /app/webapps166M /app/tmp13M /app/logs2.0M /app/abc28K /app/def16K /app/hij find /app -type f -exec du -hs {} + | sort -h | tail -100 /app 폴더안의 각 파일들을 모두 확인할 수 있다.
httpd conf workers.properties참고
worker.list=tomcat1,tomcat2,loadballance worker.tomcat1.type=ajp13 worker.tomcat1.host=localhost worekr.tomcat1.port=9006 worker.tomcat1.lbfactor=100 # 반드시 '0'보다 커야하며, 이것은 job에 대한 비율 worker.tomcat1.socket_timeout=1800 # 30분 worker.tomcat1.recycle_timeout=1800 worker.tomcat1.cache_timeout=1800 worker.tomcat1.socket_keepalive=1 # 사용:1, 미사용:0 worker.tomcat1.connection_pool_timeout=600 worker.tomcat2.type=ajp13 worker.tomcat2.host=localhost worker.tomcat2.port=9007 worker.tomcat2.lbfactor=100 worker.tomcat2.socket_timeout=1800 # 30분 worker.tomcat2.recycle_timeout=1800 worker.tomcat2.cache_timeout=1800 worker.tomcat2.socket_keepalive=1 # 사용:1, 미사용:0 worker.tomcat2.connection_pool_timeout=600 # tomcat timeout에 따른 중복 발생 방지 worker.loadballance.retries=0 worker.tomcat1.retries=0 worker.tomcat2.retries=0 worker.tomcat1.socket_timeout=60 worker.tomcat2.socket_timeout=60 worker.loadballance.type=lb # sticky방식은 일정 시간(session time)동안 … 계속 읽기 httpd conf workers.properties참고