0%

Linux

Linux

Here, I will slowly update some knowledge points about Linux

Nohup(no hang up)

It’s used to run commands in the background of system hang up. Exiting the terminal will not affect the running of the program

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# nohup Command [ Arg … ] [ & ]
# Command:the command will be executed
# Arg:some parameters, we can specify the output file
# &:hang the program in the background

# running the python program
nohup python bot.py &

# specify the output file to runoob.log
nohup python bot.py > runoob.log &

# 0 – stdin (standard input)
# 1 – stdout (standard output)
# 2 – stderr (standard error)
# 2>&1: Redirect the standard error 2 to standard output &1, and &1 is redirected to the runoob.log file
nohup python bot.py > runoob.log 2>&1 &

References

-------------The end of this article, thanks for reading-------------