본문으로 건너뛰기

nohup

nohup​

개요​

  • Linux, Unix 에서 HUP(hangup) Signal 을 무시하고 명령어를 실행시키는 명령어
  • 표준 출력을 nohup.out 파일에 출력함
    • 파일 위치는 변경이 가능하다
  • daemonize 와 동일한 기능

사용법​

  • 표준 출력
# 일반적인 출력
$ echo 'Hello World'
Hello World

# nohup
$ nohup echo 'Hello World'
nohup: ignoring input and appending output to 'nohup.out'

$ cat nohup.out
Hello World

# 파일 출력
$ nohup echo 'Hello World' > test.txt
nohup: ignoring input and redirecting stderr to stdout

$ cat test.txt
Hello World

# 출력 안하기
$ nohup echo 'Hello World' > /dev/null
nohup: ignoring input and redirecting stderr to stdout

$ cat nohup.out
cat: nohup.out: No such file or directory
  • background 실행
$ nohup ./shell.sh &
nohup: ignoring input and appending output to 'nohup.out'

$ ps -ef | grep shell.sh
...

출처​