This is the 26th day of my participation in the Gwen Challenge in November. Check out the details: The last Gwen Challenge in 2021.”

Recently, due to the company’s project needs to migrate to the cloud server, it is really difficult to take into account the operation and maintenance of development alone. Due to the unfamiliarity, I have encountered a variety of small holes, so I would like to record here, and please correct the shortcomings.

Question: Will the tomcat service stop after the tomcat command line is closed?

In Linux, switch to apache-tomcat-8.5.73/bin/ and run the./startup.sh command. This will start successfully, but the service will stop when CTRL/C exits the command line.

Solution: Run the nohup./startup.sh & command to start the service

[root@ecs-d8ce ~]# CD /data/liuzhuren/apache-tomcat-8.5.73/bin/ [root@ecs-d8ce bin]# nohup./startup.sh & [1] 34925Copy the code

Then the problem was solved successfully.

Expanding knowledge:

1.nohup

Purpose: To run commands without hanging up.

Syntax: nohup Command [Arg… [&]

Whether or not the output of the nohup command is redirected to the terminal, the final 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 needs to be redirected to the $HOME/nohup.

If no file can be created or opened for appending, the Command specified by the Command argument cannot be called.

Exit status: This command returns the following exit values:

126 The Command specified by the Command argument can be found but cannot be invoked.

127 An error occurs in the nohup Command or the Command specified by the Command parameter cannot be found.

Otherwise, the exit status of the nohup Command is the exit status of the Command specified by the Command parameter.

2. &

Purpose: Run in background

Usually both are used together

[root@ecs-d8ce ~]# CD /data/liuzhuren/apache-tomcat-8.5.73/bin/ [root@ecs-d8ce bin]# nohup./startup.sh & [1] 34925Copy the code

This works even if tomcat is running in the background, even if you exit the command line or disconnect.

Everyone likes, likes, likes, comments, clocked the article updated 105/365 days