When our AnQiCMS website is running on a Linux server, it may occasionally encounter a situation where the program does not respond, causing the website to be unable to access normally.This is like a car suddenly cutting out on the highway, causing anxiety.As website operation experts, we know how important the stable operation of the website is.AnQiCMS is a content management system developed based on the Go language, with high performance and stability as its features. Although designed to be robust, any software may encounter a deadlock due to resource exhaustion, code deadlock, or external dependency issues under certain conditions.To face such situations, learning how to forcibly stop the process in a Linux system is a key skill to ensure the rapid restoration of website access.
In general, when the AnQiCMS program becomes unresponsive, our preferred method is to attempt 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.shDeployed, there is likely a specialstop.shThe script is responsible for the normal shutdown of the program. This script will send a termination signal to the AnQiCMS process, allowing it to complete some cleanup work, such as saving data or closing connections, and then exit.You can find and run this script in the installation directory of the program, for example:
./stop.sh
However, if the program is completely frozen, it does not respond to normal termination signals, orstop.shThe script did not work either, and we need to take more 'tough' measures, that is, force 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 Linux systems, each running program has a unique PID.We can usepsandgrepThese commands are used to search. Because the executable files of AnQiCMS are usually named asanqicmsWe 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 isgrepCommand its own process, this can be ignored. Make sure to identify carefully and ensure that you find the PID of the main AnQiCMS program.
Sometimes a program may fail to start or respond because the port is occupied, other than searching by process name. In this case, if you know the port that AnQiCMS is listening on (usually it is
default8001), can also be accessed throughlsofCommand to find the process occupying the port:
lsof -i:8001
This command will display the occupation8001Port process information, which includes PID. After finding the correct PID, we can usekill -9the command to forcibly terminate it:
kill -9 12345
to12345Replace with the actual process ID of the AnQiCMS you find.This command will immediately kill the AnQiCMS process.To confirm that the process has stopped, you can run it againps aux | grep anqicmsCommand. If there is no process information for AnQiCMS left (exceptgrepits own process), it means the program has stopped successfully.
If your AnQiCMS is deployed in a Docker container, the way to manage the process will be different, you need to operate the container through Docker commands. First, you need to find the Docker container ID or name 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 immediately, you can use:
docker kill [容器ID或名称]
After stopping the container forcibly, you may need to decide according to Docker's configuration whether to restart the stopped container (docker start [容器ID或名称]), or deploy a new container.
After forcing the AnQiCMS process to stop, the most critical step isrestartit. For those who usestart.shscript deployment, execute./start.shAs soon as it is possible; for Docker deployments, they can be automatically restarted according to their startup strategy, or manuallydocker start. Also, it is recommended to check the AnQiCMS runtime logs (for example, in the installation directory below)running.logorcheck.logTo understand the possible causes of program crashes and find solutions to avoid similar problems from recurring.
Forcibly stopping a process is an effective means of solving unresponsive problems, but it is not a fundamental solution.A healthy website operation strategy should include regular monitoring of system resources, checking program logs, timely updating AnQiCMS versions, and optimizing configurations to minimize the occurrence of program unresponsiveness.
Frequently Asked Questions (FAQ)
Q1: Usekillandkill -9What are the differences? Why is it recommended to use.kill -9to perform a forced stop?
A1:killThe command sends by default isTERMThe signal (Terminate, stop), it tells the program to close normally, giving it a chance to save data and release resources.If the program can respond, this is the smoothest way to exit. Andkill -9The one sent isKILLA signal, this is an uncatchable, non-ignorable signal, the system will immediately force terminate the process, without giving the program any processing time. When the program is unresponsive, it means it cannot handle itTERMThe signal, at this timekill -9has become 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 forcing the AnQiCMS process to stop and restart, if the website still cannot be accessed, the first thing to confirm is whether the program has really started successfully. You can check byps 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 is still inaccessible, it may be due to other reasons, such as: incorrect configuration or restart of Nginx/Apache reverse proxy services;The firewall blocked access to the AnQiCMS port; the database service connected to AnQiCMS is abnormal;Or AnQiCMS encountered a new error during startup, causing it to crash again.Need to investigate these possibilities one by one.
Q3: How do I know which port AnQiCMS is listening on? I didn't find a clear port number in the configuration.
A3: The default port listened by AnQiCMS is usually8001. 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.If manually deployed, this port number is usually in the project'sconfig.jsondefined in the configuration file. If the above methods cannot determine, you can try usingnetstat -tulnp | grep anqicmsorlsof -i -P -n | grep LISTEN | grep anqicmsCommand to view the actual network port that AnQiCMS process is listening on.