반응형

bash 스크립트를 통해 주어진 이름의 프로세스가 시스템 상에서 동작 중인지 확인하는 bash 스크립트 구현에 대해 알아본다.

 

여기서 이용한 것은 pgrep 이라는 명령어 이다.

pgrep 에 대해 linux man page에 기재되어 있는 내용을 간단히 살펴보면 아래와 같다.

  • pgrep : looks through the currently running processes and lists the process IDs which match the selection criteria to stdout. All the criteria have to match

 

- 시스템 상 특정 프로세스가 구동 중인지 확인하기 위한 bash 스크립트로 pgrep을 활용하는 방법

#!/bin/bash

PROC="some_process"
if pgrep -f "PROC" >/dev/null
then
    echo "$PROC is running"
else
    echo "$PROC is not running"
fi
반응형

'Spadeworks > bash' 카테고리의 다른 글

[bash] 파일 크기 순으로 검색  (0) 2023.12.12
[bash] 명령어 반복  (0) 2023.09.19
[bash] 파일 탐색  (0) 2023.09.10
[bash] bash를 이용한 json 파일 파싱  (0) 2022.08.11
[bash] 특정 길이의 무작위 문자열 획득  (0) 2022.08.11
반응형

개발자로 살아오며 GO는 한번도 써본적이 없지만 이번에 어쩌다 보니 build dependency 가 생겨 빌드를 하던 와중 아래와 같은 Error 메시지와 조우하게 되었다.
앞으로도 당분간은 GO는 사용할 일이 없을 것 같아 Error 메시지의 의미나 발생 원인에 대해서는 딱히 확인하지 않고 단순 빌드가 성공되도록 처리만 하였다.
방법은 아래의 Solutions 에 설명한 것과 같이  golang-go 를 설치하는 것이다.

Error

hash/maphash: malformed module path "hash/maphash": missing dot in first path element


Solutions

sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt update
sudo apt install golang-go
반응형
반응형

Dockerfile을 작성할 때, 주로 가장 먼저 locale 설정을 수행하곤 한다.

따라서 대부분의 Dockerfile 은 아래와 같이 시작되는 경우가 많다. 

FROM ubuntu:latest
RUN apt-get update && apt-get install -y locales
... 이하 생략

대부분의 Dockerfile 이 있으면 docker build . 명령어를 통해 docker image 를 빌드하기 마련인데 아래와 같은 메시지가 뜨며 빌드에 실패하는 경우가 있다.

E: Package 'locales' has no installation candidate

 

이 경우에는 아래의 명령어로 docker daemon을 재시작 한 후 다시 Dockerfile을 빌드 해보자.

service docker restart
반응형

+ Recent posts