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

The principle and how to use nohup

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "the principle of nohup and how to use it". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the principle of nohup and how to use it.

The nohup command runs the command specified by the Command parameter and any related Arg parameters, ignoring all SIGHUP signals. Use the nohup command to run the program in the background after logging out. To run the nohup command in the background, add & (the symbol for "and") to the end of the command.

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

At this point, I believe you have a deeper understanding of "the principle and how to use nohup". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Development

Wechat

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

12
Report