Unix 720

pm2 logrotate

pm2가 다 좋은데 logrotate만 없다 (?) 있는데 기본은 아니고 pm2 plugin이다. 그냥 시스템에 설치된 것으로 할지 pm2 plugin으로 할지 약간은 고민이 된다. /etc/logrotate.d/pm2-ubuntu /home/ubuntu/.pm2/logs/*.log { su ubuntu ubuntu daily rotate 10 copytruncate delaycompress compress notifempty missingok } 시스템 기본 logrotate로 한다면 위와 같이 하면 된다.. 하지만 시스템 파일을 건드려야 한다는 단점이 있다. 하지만 대부분 시스템에 있는 것을 활용하는 것이기도 하고, 세팅에 참고할 자료가 많음. pm2 logrotate로 구글링하면 한국자료도 많이 나..

Unix 2023.01.17

btdu - ncdu vs btrfs

btrfs를 쓰다보면 가끔 당혹스러울 때가 있다. ncdu로 파일의 크기만 합쳐놓고 보면 0.9 TB인데 df -h로 보면 1.8 TB를 먹고있는 것이다! 블록크기가 좀 큰가보다. btdu란 툴을 쓰면 어느 공간이 어떻게 쓰이고 있는지 대충 볼 수 있다. https://github.com/CyberShadow/btdu GitHub - CyberShadow/btdu: sampling disk usage profiler for btrfs sampling disk usage profiler for btrfs. Contribute to CyberShadow/btdu development by creating an account on GitHub. github.com 아치리눅스 aur 패키지는 존재하는데, 다른 ..

Unix 2022.11.25

SSH에 2FA (Google authenticator) 적용하기

의외로 몹시 쉽다. Instructions https://ubuntu.com/tutorials/configure-ssh-2fa#1-overview 공식 가이드인데 디테일이 조금 부족 https://dev.to/himadriganguly/configure-ssh-server-with-key-based-and-two-factor-authentication-3oc2 이걸 보고 했다. https://serverfault.com/questions/1073593/ssh-public-key-authentication-with-google-authenticator-still-asks-for-password 여기도 같은 맥락의 답이 달려있다. sudo apt install libpam-google-authenticato..

Unix 2022.11.15

APC UPS SMC1500I-2UC 설정

APC 메뉴얼도 구리고 소프트웨어도 구려서 설정하는데 애먹었다. 매뉴얼 쓸모없음 수작업으로 self-test 시작하는 방법도 알려줄법도 한데 그런것도 안 적혀있음 https://www.youtube.com/watch?v=17LFCegFg8M 테스트는 위 동영상을 참고. Smart Connect 쓸모없음. 되는게 없다. 구독모델인 것 같은데 기본적 기능까지 구독으로 해버린 느낌임. 그래도 장비를 등록하면 배터리모드로 전환될 때 이메일 정도는 오는 것 같다. IP주소 심기 https://www.apc.com/ca/en/faqs/FA321794/ How to assign a fixed IP address to SmartConnect enabled Smart-UPS | APC Canada www.apc.com ..

Unix 2022.09.03

특정 포트로 들어온 트래픽 다른 호스트로 포워딩하기

#!/bin/bash # 이 스크립트는 sudo로 실행시킬 것 # 이 host에서 `telnet 192.168.111.222 9999` 를 눌러서 접속이 되면 ok, # 잘못된 곳에 붙으면 아예 connection이 안 될 것임. # `curl 192.168.111.222:9999` 도 괜찮음. # curl: (1) Received HTTP/0.9 when not allowed # 이런 반응이 온다. # 점검을 한 뒤 forwarding이 실제로 되나 체크 # 참고: # https://www.digitalocean.com/community/tutorials/how-to-forward-ports-through-a-linux-gateway-with-iptables DEST=192.168.111.222 POR..

Unix 2022.07.27

Airflow 설치 & 세팅

Airflow를 왜 골랐는가? ML이라면 kuberflow를 썼을 거 같음. 그리고 아주 간단한 작업이면 cron을 썼을 것이다. 하지만 문제가 있는데, 어중간하게 복잡하다는 것이다. ex) 다운로드1, 다운로드2, 다운로드3을 한 다음 1, 2, 3이 잘 되었는지 확인을 하고싶고, 1, 2, 3은 병렬로 실행 가능하다. 작업들간의 실행 순서를 그래프로 (DAG) 표현한다면 위 처럼 될 것이다. 파이썬으로 작업을 정의할 수 있다는 것도 장점이라 선택을 함. 나름 오래 되기도 했고, 그래서 커뮤니티도 클 것이라고 판단. Airflow Airflow 설치 https://insaid.medium.com/setting-up-apache-airflow-in-ubuntu-d0317a59f8a4 를 따라했다. 시스템..

Unix 2022.07.10

docker + wine + MFC 조합으로 키움증권 OpenAPI 리눅스 실행 성공

평상시에는 윈도우 없이 편안하게 클라우드에서 실행이 가능하다. ㄷㄷㄷㄷㄷ https://github.com/forcecore/KiwoomRestfulCpp/blob/master/docker/README.md GitHub - forcecore/KiwoomRestfulCpp Contribute to forcecore/KiwoomRestfulCpp development by creating an account on GitHub. github.com 좀 더 가다듬은 다음에 내놓으려고 했는데 일단 선공개 한다. https://github.com/forcecore/KiwoomRestfulCpp/releases -> exe파일 자체는 여기 있다. Wine version wine-6.22 Winetricks versi..

Unix/Arch Linux 2021.12.09

handlr - xdg-open 상위호환

xdg-open은 KDE에서 지정된 앱 이외 이상한 자체 값들을 보유하고 있어서 미묘하게 짜증나게 군다. 예를들면 PDF를 열면 wine explorer로 열린다든지, 폴더를 열라고 하면 dolphin이 아닌 thunar가 열린다든지... 코멘트로 좋은 소개를 받아서 설치해보았다. https://github.com/chmln/handlr GitHub - chmln/handlr: A better xdg-utils A better xdg-utils. Contribute to chmln/handlr development by creating an account on GitHub. github.com 그리고 github 글에 의하면 yay라니... 이분, 아치리눅스 유저네? AUR에 handlr-bin, xdg..

Unix/Arch Linux 2021.11.27

포트포워딩 명령어, 자꾸 까먹어서

검색하면 나오기는 하는데 내가 쓰는 조합이 맘에 들어서. ssh -N -v -L 8888:localhost:9999 ID@REMOTE_HOST localhost (내쪽) 8888로 가는 접속을 원격 host의 9999로 보내되, -N Do not execute a remote command. This is useful for just forwarding ports. Refer to the description of SessionType in ssh_config(5) for details. -v Verbose mode. Causes ssh to print debugging messages about its progress. This is helpful in debugging connection, authe..

Unix 2021.11.21