본문 바로가기

카테고리 없음

centos job을 background로 실행시키고 일단 나몰라라 퇴근하고 싶을때

& nohup

만 기억하세요

 

ex)

nohup bin/logstash -f ./current-logstash-backup.conf --path.data ./data2 > /root/nohup.log 2>&1 &
Run a Linux Command in the Background
To run a command in the background, add the ampersand symbol (&) at the end of the command:
command &
The shell job ID (surrounded with brackets) and process ID will be printed on the terminal:

[1] 25177
You can have multiple processes running in the background at the same time.
The background process will continue to write messages to the terminal from which you invoked the command. To suppress the stdout and stderr messages use the following syntax:

command > /dev/null 2>&1 & 
>/dev/null 2>&1 means redirect stdout to /dev/null and stderr to stdout .

Use the jobs utility to display the status of all stopped and background jobs in the current shell session:

jobs -l

 

https://linuxize.com/post/how-to-run-linux-commands-in-background/