Get the App
SLTechnology News&Howtos  ›  Servers  › 

The usage of , nohup and Systemctl in linux

Shulou Source: shulou.com Published: 2022-06-01 20:04:04 09月22日 Update

This article mainly introduces the use of linux &, nohup and Systemctl, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand.

&, nohup and Systemd

When the client browser first accesses the server, the server creates a different HttpSession object for each browser. Use the request.getSession () method on the server side to get the HttpSession object and use the methods provided for us by the HttpSession interface.

When will session expire?

The server clears the session that has not been active for a long time from the server memory, and the Session becomes invalid. The default failure time for Session in Tomcat is 20 minutes.

Call the invalidate method of Session.

Close the browser and end session.

1. Use & run the program in the background:

The result will be output to the terminal.

Use Ctrl + C to send SIGINT signal, program immunity

Close session to send SIGHUP signal, program shuts down

two。 Run the program using nohup:

The result is output to nohup.out by default

Use Ctrl + C to send SIGINT signal, the program shuts down

Turn off session to send SIGHUP signal, program immune

Therefore, nohup and & cooperation are often used online to start programs: SIGINT and SIGHUP signals can be immunized at the same time.

3. Systemctl:

Systemctl is a systemd tool that controls the systemd system and service manager.

Type ps ax | grep systemd in the terminal and see the first line, where the number 1 indicates that its process number is 1, which means it is the first program initiated by the Linux kernel. Therefore, once the kernel has detected the hardware and organized the memory, it runs the / usr/lib/systemd/systemd executable program, which initiates other programs in order. In the days before Systemd, the kernel would run / sbin/init, and then the program would run the rest of the startup scripts on a system called SysVinit. )

Tip: the .service suffix at the end of this name can be omitted because the default suffix for systemctl is .service. The meaning of the Unit file suffix will be explained in detail in subsequent advanced articles.

Systemd automatically finds the .service file in the / usr/lib/systemd/system directory and starts the services defined in it. If the Unit file you created earlier is in a different directory, you need to use the full path to the file.

Thank you for reading this article carefully. I hope the article "how to use linux & nohup and Systemctl" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Programs services methods signals servers runs files articles kernels suffixes browsers immunity browsing usage memory simultaneously objects directories systems terminals Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MySQL OPPO Reno vpn Docker