본문 바로가기

IT/infra

nohup 사용법

반응형

no hang up; nohup


nohup 사용법

프로세스 중단(hangup)을 무시하고 명령어를 실행하는 명령어

표준출력을 nohup.out(또는 다른 곳)으로 돌림


기본 (nohup.out 출력)

nohup 없이 echo 실행

[root@ ~]# echo hello

hello

→ 터미널 화면에 출력된다.


nohup으로 echo 실행

[root@ ~]# nohup echo hello

nohup: appending output to `nohup.out'

[root@ ~]# cat nohup.out

hello

→ echo 내용이 nohup.out으로 출력되었다.


다른 파일에 출력[편집]

[root@ ~]# nohup echo hello > 1.txt

[root@ ~]# cat 1.txt

hello

출력 안하기[편집]

/dev/null에 출력하도록 바꾸면 어디에도 출력되지 않는다.


[root@ ~]# rm -f nohup.out

[root@ ~]# nohup echo hello > /dev/null

[root@ ~]# cat nohup.out

cat: nohup.out: No such file or directory

반응형

'IT > infra' 카테고리의 다른 글

docker container connect  (0) 2017.07.18
[CENTOS7] 원격 GUI 접속  (0) 2017.07.17