Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the principle of nohup and its actual combat analysis

2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article shows you what the nohup principle is and the actual combat analysis. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

This paper mainly introduces the principle of Linux nohup command and example parsing, which is introduced in detail through the example code, which has a certain reference value for everyone's study or work.

Nohup command

When applying Unix/Linux, we usually want a program to run in the background, so we will often use & at the end of the program to let the program run automatically. For example, we want to run mysql in the background: / usr/local/mysql/bin/mysqld_safe-user=mysql &. But there are a lot of programs that are not like mysqld, so we need nohup commands.

Process and job management

The nohup command can run the program in a way that ignores the suspend signal, and the output information of the program being run will not be displayed to the terminal.

Whether or not the output of the nohup command is redirected to the terminal, the output is appended to the nohup.out file in the current directory. If the nohup.out file in the current directory is not writable, the output is redirected to the $HOME/nohup.out file. If there is no file that can be created or opened for append, the command specified by the command parameter cannot be called. If standard error is a terminal, the specified command is written to all outputs of standard error as standard output is redirected to the same file descriptor.

Grammar

Nohup (option) (parameter)

Option

-- help: online help-- version: display version information

Parameters.

Programs and options: programs and options to run

Example

one

Run the jar package of spring boot, and the Spring Boot project is still running in the background when the current terminal is closed

Nohup java-jar springboot.jar &

two

Use the nohup command to submit a job, and if you use the nohup command to submit a job, all output from that job is redirected by default to a file named nohup.out, unless another output file is specified:

Nohup command > myout.file 2 > & 1 &

In the above example, the output is redirected to the myout.file file

The above content is what the nohup principle is and the actual combat analysis. Have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report