multi thread는 필요한데 mutex 는 안쓰는 쪽으로?

프로그래밍/c,c++ 2024. 4. 3. 23:59
반응형

무서운 deadlock 때문에 나온 의견

process는 죽을순 있지만 멈추면 안돼~

반응형
:

crontab 에서 사용하는 값 정리

OS/linux 2024. 4. 3. 23:39
반응형

cron 은 주기적으로 특정 작업을 스케쥴링하기 위해 리눅스에세 제공해 주는 명령으로

contab 을 통해 작업들을 설정한다.

 

editor 설정

crontab -e 실행시 select-editor 명령이 호출되어 editor 설정된다.

editor를 바꾸고 싶을때는 select-editor 를 실행 하거나 ~/.selected_editor 의 SELECTED_EDITOR 의 값을 바꾼다.

select-editor 명령 실행시 원하는 editor가 없을 경우에는 SELECTED_EDITOR 값을 변경하자.

 

crontab -e 명령을 실행하면 다음과 같은 형식으로 값을 사용하면 된다.

m h  dom mon dow   command

field          allowed values
-----          --------------
minute         0–59
hour           0–23
day of month   1–31
month          1–12 (or names, see below)
day of week    0–7 (0 or 7 is Sun, or use names)

(Manual page crontab(5))

 

사용 예는 다음과 같다

The following lists an example of a user crontab file.    
    
# use /bin/bash to run commands, instead of the default /bin/sh    
SHELL=/bin/bash    
# mail any output to `paul', no matter whose crontab this is    
MAILTO=paul    
#    
# run five minutes after midnight, every day    
5 0 * * *       $HOME/bin/daily.job >> $HOME/tmp/out 2>&1    
# run at 2:15pm on the first of every month — output mailed to paul    
15 14 1 * *     $HOME/bin/monthly    
# run at 10 pm on weekdays, annoy Joe    
0 22 * * 1-5    mail -s "It's 10pm" joe%Joe,%%Where are your kids?%    
23 0-23/2 * * * echo "run 23 minutes after midn, 2am, 4am ..., everyday"    
5 4 * * sun     echo "run at 5 after 4 every Sunday"    
0 */4 1 * mon   echo "run every 4th hour on the 1st and on every Monday"    
0 0 */2 * sun   echo "run at midn on every Sunday that's an uneven date"    
# Run on every second Saturday of the month    
0 4 8-14 * *    test $(date +\%u) -eq 6 && echo "2nd Saturday"    
    
All the above examples run non-interactive programs.  If you wish to run a program that interacts with  the    
user's desktop you have to make sure the proper environment variable DISPLAY is set.    
    
# Execute a program and run a notification every day at 10:00 am    
0 10 * * *  $HOME/bin/program | DISPLAY=:0 notify-send "Program run" "$(cat)"

(Manual page crontab(5))

 

예약어도 사용할수 있다

string         meaning
------         -------
@reboot        Run once, at startup.
@yearly        Run once a year, "0 0 1 1 *".
@annually      (same as @yearly)
@monthly       Run once a month, "0 0 1 * *".
@weekly        Run once a week, "0 0 * * 0".
@daily         Run once a day, "0 0 * * *".
@midnight      (same as @daily)
@hourly        Run once an hour, "0 * * * *".

(Manual page crontab(5))

 

반응형
:

Ubuntu 설치시 프로그램 및 환경 정리

OS/linux 2023. 11. 30. 23:08
반응형

Ubuntu를 새로 깔면 기본적으로 해주는 것들

 

기본 프로그램

터미널 프로그램 - 창분할이 되어 탭보기 보다 편하다

sudo apt install terminator

원격 연결을 위한 ssh 서버 설치
sudo apt install openssh-server

sh가 dash 로 심볼릭 되어 있어 bash 로 바꿔줌
sudo ln -sf bash sh

시스템 리소스 모니터링용으로 설치
sudo snap install htop

ifconfig 쓸려고 설치
sudo apt install net-tools

ZSH 설치 - 터미널 작업을 할때 엄청난 효율 상승

zsh 을 설치한 후 oh-my-zsh 을 설치한다
sudo apt install zsh

깔린게 없어서 curl도 깔아주고
sudo snap install curl

curl 로 설치 파일 다운로드 후 설치

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

prompt 테마 설치 - 보기 좋은게 쓰기도 편하다

cd .oh-my-zsh/custom/themes
git clone https://github.com/romkatv/powerlevel10k.git

플러그인 설치하기

타이핑 조금 하면 이전에 실행한 명령을 보여준다

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

입력한 내용에 대한 색깔 입히기
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting

cd 명령 실행시 보다 편리한 사용, fzf 를 통해 리스트를 뿌려주고 이동할 디렉토리로 이동
git clone https://github.com/b4b4r07/enhancd.git $ZSH_CUSTOM/plugins/enhancd
cd .oh-my-zsh/custom/plugins
git clone https://github.com/arzzen/calc.plugin.zsh.git
sudo apt install fzf

cat 명령에 컬러를 입힌 명령
sudo apt install bat

ls 명령에 아이콘 출력 등 보기 좋게 바꾼 명령
sudo apt install ./lsd-musl_1.0.0_amd64.deb

폰트 설치

zsh을 사용하면서 결과를 정상적으로 보려면 nerd 폰치 설치가 필요함
git clone https://github.com/ryanoasis/nerd-fonts.git
cd nerd-fonts
./install.sh

D2Coding 폰트 설치 - 보기에 좋아서
.local/share/fonts/D2Coding-Ver1.3.2-20180524-all.ttc .

설치된 폰트 시스템에 적용 명령
fc-cache -fv

이모지가 보이도록 폰트 설치
sudo apt install fonts-emojione
sudo apt install fonts-noto-color-emoji

snippet 유틸(기존 설정 등)

massCode - 이런저런 메모들 저장, 최신 버전(다른 저장소에서 릴리즈) 보다 이 버전이 편한 느낌

https://github.com/antonreshetov/massCode/releases
chmod 755 massCode-1.3.1.AppImage

기존 저장 메모 유지
scp -r 백업서버IP:~/massCode .

브라우저 설치
sudo apt install ./google-chrome-stable_current_amd64.deb

개발툴 설치

neovim 설치(플러그인 따로 정리)

tar xvfz nvim-linux64.tar.gz
cd nvim-linux64/bin
cd .vim
mkdir bundle
cd bundle
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

소스 관리 툴 - git, repo
sudo apt install repo
sudo apt install python
sudo apt install python3
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
sudo apt install git

vscode 설치 - c++, java 를 주로 사용하는데 이거만한게 없다
sudo apt-get install wget gpg\nwget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg\nsudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg\nsudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'\nrm -f packages.microsoft.gpg
sudo apt install apt-transport-https

sudo apt update

sudo apt install code

리눅스 배포판, 버전에 따라 빌드 환경이 영향을 받는 걸 피하고 싶을때 docker 설치
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
sudo apt-get update

sudo apt-get install ca-certificates curl gnupg\nsudo install -m 0755 -d /etc/apt/keyrings\ncurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg\nsudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \\n  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \\n  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \\n  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo docker run hello-world
sudo usermod -aG docker $USER

git diff 예쁘게 보기
chmod 755 diff-so-fancy

비교툴
sudo apt install ./bcompare-4.3.6.25063_amd64.deb

vim 플러그인에서 c 언어 참조용
sudo apt install libclang-dev

kotlin, java 개발용
tar xvfz ideaIC-2023.2.5.tar.gz

그외 유틸들

grep 개선 버전
sudo apt install ripgrep

find 개선 버전
sudo apt install fd-find

언제든 터미널 즉시 실행
sudo apt install guake

teams 설치
sudo snap install teams-for-linux

원격 데스크탑 설치
sudo apt install remmina

그놈 설정용 툴
sudo apt install gnome-tweaks

sudo apt install dconf-editor
sudo apt install gnome-shell-extension-manager
가상머신 - 가끔식 윈도우가 필요할때가 있다
sudo apt install ./virtualbox-7.0_7.0.12-159484\~Ubuntu\~jammy_amd64.deb

ssh를 통한 원격 파일시스템 마운트
sudo apt install sshfs

화면에서 gif 캡쳐 만들기
sudo apt install peek

온도 확인하기
sudo apt install lm-sensors

sudo apt install psensor

그림 그리기

sudo apt install gimp

반응형
: