When our AnQiCMS website runs on a Linux server, it may occasionally encounter a situation where the program does not respond, causing the website to be inaccessible.This is like a car suddenly dying on the highway, causing anxiety.As website operations experts, we understand how important the stable operation of a website is.AnQiCMS as a content management system developed based on Go language, featuring high performance and stability, although designed to be robust, any software may encounter a deadlock due to resource exhaustion, code deadlock, or external dependency issues under certain conditions.Learn how to forcibly stop the process in a Linux system when facing such situations, which is a key skill to ensure the quick recovery of website access.
In most cases, when the AnQiCMS program does not respond, our preferred method is to try a "gentle" shutdown. If AnQiCMS is accessed through the Go project feature of Baota panel, or directly through a command-line script (such asstart.shandstop.shAutomatically deployed, it is likely that there is a dedicatedstop.sh脚本是用于程序的正常关闭。This script will send a termination signal to the AnQiCMS process, giving it a chance to finish some cleanup work, such as saving data or closing connections, before exiting.
./stop.sh
However, if the program is completely frozen and does not respond to conventional termination signals, orstop.shThe script did not work either, and we need to take more 'forceful' measures, that is, to forcibly stop the process.This is like directly pulling the plug, the program will immediately terminate without any cleanup, so this is usually the last resort.
To forcibly stop an unresponsive AnQiCMS process, we first need to find its process ID (PID).In the Linux system, each running program has a unique PID.psandgrepThese commands are used to search. Because the executable files of AnQiCMS are usually namedanqicmsWe can search like this:
ps aux | grep anqicms
After executing this command, you will see an output similar to this:
user 12345 0.5 1.2 123456 45678 ? Sl Jan01 5:30 /path/to/your/anqicms/anqicms
user 67890 0.0 0.0 6020 1080 pts/0 S+ 10:00 0:00 grep --color=auto anqicms
In the above output, the first line is the actual running process of AnQiCMS, its PID is12345. The second line isgrepCommanding its own process, this can be ignored. Please make sure to carefully identify and ensure that you find the PID of the AnQiCMS main program.
除了通过进程名查找,有时程序可能因为端口被占用而无法启动或响应。在这种情况下,如果你知道AnQiCMS监听的端口(默认通常是8001),也可以通过lsof命令来查找占用该端口的进程:
lsof -i:8001
这条命令会显示占用8001Port process information, which includes PID. After finding the correct PID, we can usekill -9the command to force terminate it:
kill -9 12345
to12345Replace it with the actual AnQiCMS process ID you find.Execute this command and the AnQiCMS process will be immediately terminated by the system.ps aux | grep anqicmsCommand. If there is no process information for AnQiCMS (exceptgrepits own process), it means the program has stopped successfully.
If your AnQiCMS is deployed in a Docker container, the management process will be different. You need to operate the container using Docker commands. First, you need to find the Docker container ID or name that is running AnQiCMS.
docker ps
This command lists all running Docker containers. After finding the container corresponding to AnQiCMS, you can first try to stop it 'gently':
docker stop [容器ID或名称]
If the container has not stopped for a long time, or needs to be terminated forcibly, you can use:
docker kill [容器ID或名称]
After force stopping the container, you may also need to decide whether to restart the stopped container based on Docker's configuration, or to redeploy a new container.docker start [容器ID或名称]), or to redeploy a new container.
After forcing the AnQiCMS process to stop, the most critical step isrestartit. For those who usestart.shscript deployment, execute./start.shEnglishdocker start. Meanwhile, it is recommended to check the running logs of AnQiCMS (such as the installation directory under)running.logorcheck.log)To understand the possible causes of program crashes and find solutions, to avoid similar problems from happening again.
Forcing a process to stop is an effective means to solve unresponsive problems, but it is not a permanent solution.An English healthy website operation strategy should include regular monitoring of system resources, checking program logs, timely updating the AnQiCMS version, and optimizing configurations to minimize the occurrence of program unresponsiveness.
Common Questions (FAQ)
Q1: Usekillandkill -9What are the differences? Why is it recommended to usekill -9to force stop?
A1:killThe command sends by default isTERMSignal (Terminate, Terminate), it tells the program to close normally, giving the program a chance to save data and release resources.If the program can respond, this is the smoothest way to exit.kill -9is sentKILLSignal, this is an uncatchable, non-ignorable signal. The system will immediately terminate the process without giving the program any processing time. When a program does not respond, it means it cannot handle itTERMSignal, at thiskill -9it becomes the only choice, because it can ensure that the process is killed immediately.
Q2: What should I do if the website is still inaccessible after forcibly stopping AnQiCMS?
A2: After forcibly stopping and restarting the AnQiCMS process, if the website still cannot be accessed, the first thing to confirm is whether the program has really started successfully. You can check throughps aux | grep anqicmsCommand to check again, or view the program's startup log (for examplerunning.log)。If the program is indeed running but the website cannot be accessed, it may be due to other reasons, such as: Nginx/Apache reverse proxy services are not configured correctly or restarted; the firewall is blocking access to the AnQiCMS port; the database service connected to AnQiCMS is abnormal; or AnQiCMS encountered new errors during startup, causing it to crash again.Need to check each possibility one by one.
Q3: How to know which port AnQiCMS is listening on? I didn't find an explicit port number in the configuration.
A3: AnQiCMS默认监听的端口通常是 English8001.If you deploy through the "Go project" or "Other project" feature of Baota panel, the project port will be explicitly specified when adding the project.config.json配置文件中定义。如果以上方法都无法确定,可以尝试使用 Englishnetstat -tulnp | grep anqicmsorlsof -i -P -n | grep LISTEN | grep anqicms命令来查看AnQiCMS进程实际监听的网络端口。