How to use the stop script `stop.sh` written by author fesion in AnQiCMS?

Calendar 👁️ 67

AnQiCMS (AnQiCMS) is an efficient and feature-rich Go language content management system, its stable operation is inseparable from fine deployment and management.As a website operator, we not only need to pay attention to content creation and optimization, but also ensure the smooth operation of the system backend.In this case, stop the scriptstop.shPlaying a crucial role, it can help us manage the lifecycle of AnQiCMS services safely and effectively.

Stop the scriptstop.shits core function

stop.shThe main function of the script is to terminate the running process of the AnQiCMS application on the Linux system.In order to carry out system maintenance, version upgrades, or to adjust the configuration, we need a reliable way to stop the running service.This script provides a standardized, command-line friendly way to achieve this goal, avoiding the繁琐 and potential errors of manually searching for the process ID (PID) and forcibly terminating.By executingstop.shEnsure that the AnQiCMS service is shut down orderly, making space for subsequent operations.

Get to know in-depthstop.shThe working principle of the script

stop.shThe script is a simple Bash script whose core logic is to find and terminate the AnQiCMS service process. The script contains several key variables and commands that together complete the stop task:

first, BINNAMEThe variable defines the name of the AnQiCMS executable file, the default beinganqicms. This name is crucial for the script to identify the target process.

secondly,BINPATHthe variable through$( cd "$( dirname "$0" )" && pwd )Command dynamically obtain the directory where the script is located, ensure that the script can be executed correctly at any location, and find the executable files and log files of AnQiCMS.

The script is then used.ps -ef | grep '\<anqicms\>' | grep -v grep | awk '{printf $2}'Combine commands to find the process ID of AnQiCMS.

  • ps -efList all running processes.
  • grep '\<anqicms\>'Filter out lines containing "anqicms" (note\<and\>Make sure to match the complete word and not a partial match)
  • grep -v grepexcludegrepCommand its own process to avoid killing by mistake.
  • awk '{printf $2}'Extract the second field of the process line, which is the process ID.

If the AnQiCMS running process is found (that isexistsIf the variable is not 0), the script will use it.kill -9 $existscommand to forcibly terminate the process.kill -9is a force kill command, meaning it will immediately terminate the process without giving the process a chance to perform cleanup operations.Although this method is usually effective, in some cases, if AnQiCMS is processing critical data, it may lead to data inconsistency.However, from the documents provided by AnQiCMS,stop.shThe default method adopted is to directly terminate.

In AnQiCMS deployment applicationstop.sh

stop.shThe script plays a role in various AnQiCMS deployment scenarios:

InBaota panelin the environment,stop.shCommonly configured as a scheduled task, for example, to run once a month, as part of maintenance or restart procedures. Operators can add a Shell script task by selecting the Scheduled Task interface on the Baota panel, and thenstop.shPaste the content in and set the appropriate execution cycle. Although the document shows it is executed monthly, in practice, we may do it more often withstart.shCooperation, used to manually restart the service when needed.

For those who passCommand lineDeployed AnQiCMS instance,stop.shThe usage is more direct. Just execute through the terminal in the AnQiCMS installation directory../stop.shCommand to stop the service. This is very useful for scenarios that require manual service management or writing automation deployment scripts.

When a server has been deployed onMultiple AnQiCMS sitesthen,stop.shThe flexibility is particularly important. If each AnQiCMS instance has a different executable file name (for example, to distinguish different sites), we need to modify it accordingly.stop.shwithin the scriptBINNAMEThe variable makes it match the executable filename of a specific instance.This ensures that we can accurately stop the target site without affecting other AnQiCMS instances that are running.

InSystem UpgradeDuring the process, especially when upgrading from AnQiCMS 2.x version to 3.x version, the document also mentioned stopping the project first using the scheduled task (i.e., runningstop.sh), then delete the old scheduled task and deploy with a new Go project. This indicatesstop.shIt is a standardized step in the upgrade process, used to ensure that the old service is completely shut down so that the new version can start smoothly.

Key considerations and operational suggestions

Usestop.shAt this point, as a website operator, we need to pay attention to the following points:

first, BINNAMEThe accuracy of variables is crucial. If the executable file of AnQiCMS is renamed, it must be updated synchronously.stop.shin the scriptBINNAMEOtherwise, the script will not be able to find and stop the correct process.

secondly,stop.shPrimarily designed for Linux environments. ForWindows systemIt is explicitly stated in the AnQiCMS documentation that there is nostop.shscript, the user needs to manually terminate through the Windows Task Manageranqicms.exeprocess. Therefore, when deploying across platforms, it should be understood that there are these differences

Finally, executestop.shafterwards, we should go throughps -ef | grep '\<anqicms\>' | grep -v grepCheck again to make sure the AnQiCMS process has indeed stopped. This is a good operational habit that can avoid service anomalies caused by script execution failure.

In summary,stop.shThe script is an indispensable part of the AnQiCMS service management toolbox.It simplifies the operation of stopping services, improves operational efficiency, and provides the necessary flexibility in multi-site and upgrade scenarios.Mastering its usage and precautions will make the daily management of AnQiCMS smoother and safer.


Frequently Asked Questions (FAQ)

stop.shCan the script be used on Windows system?No. According to the official documentation of AnQiCMS,stop.shThe script is designed for the Linux environment. On Windows systems, you need to manually terminate the process by finding it in the Task Manager.anqicms.exeto stop the service.

If I change the executable file name of AnQiCMS (for example, fromanqicmschanged tomysite)stop.shcan it still work?it will not work directly. You need to editstop.shthe script file, changing its internalBINNAMEThe value of the variable is updated to the new executable filename (for example,BINNAME=mysite), to ensure that the script can correctly identify and stop your AnQiCMS instance.start.shThe script also needs to be modified in the same way.

Executestop.shHow to confirm that the AnQiCMS service has stopped?In the Linux terminal, you can useps -ef | grep '\<anqicms\>' | grep -v grepcommand (please replaceanqicmsReplace your actual executable filename to check if there is still an AnQiCMS process running.If no output is displayed, it means that the AnQiCMS service has been successfully stopped.

Related articles

What is the main function of the startup script `start.sh` written by "author fesion" in the AnQiCMS task schedule?

In the daily operation of AnQiCMS (AnQiCMS), the stable operation of the system is the key to ensuring user experience and content distribution efficiency.To ensure that the AnQiCMS service can provide content continuously and uninterruptedly, even if it encounters unexpected interruptions and can recover quickly, a meticulously designed startup script plays a crucial role in the scheduled tasks.Among them, the `start.sh` script written by "author fesion" was born for this purpose, and it constitutes the core of the self-protection mechanism of AnQiCMS service.### `start

2025-11-06

How to configure Nginx pseudo-static rules for AnQiCMS on the Baota panel?

As an experienced CMS website operation personnel of AnQi, I know that efficient content management and excellent search engine optimization (SEO) play a decisive role in the success of the website.Static page, it is an indispensable part of it, not only does it make the website URL structure more concise and beautiful, but more importantly, it can significantly improve the search engine's ability to capture and understand the content of the website.AnQiCMS was designed with this in mind from the beginning, it has built-in powerful pseudo-static management functions, but to make full use of it, the configuration of Nginx pseudo-static rules on the server side is crucial

2025-11-06

How to install AnQiCMS's Go project on a Linux server?

As a website operator familiar with AnQiCMS, I fully understand the importance of an efficient, stable, and easy-to-manage content system for website operation.AnQiCMS is a modern enterprise-level content management system developed based on the Go language, with its high concurrency, high security, easy deployment, and excellent SEO-friendly features, it has become an ideal choice for many small and medium-sized enterprises and content operation teams.This article will detail how to install and deploy AnQiCMS's Go project on a Linux server, aiming to help you smoothly set up your own website.###

2025-11-06

What operating systems does AnQiCMS support for deployment and use?

As an experienced AnQi CMS website operations personnel, I am very clear about the deployment and usage of AnQi CMS in different operating system environments.AnQiCMS is an enterprise-level content management system developed based on the Go language, which was designed with cross-platform compatibility in mind, aiming to provide users with flexible and diverse deployment options.

2025-11-06

How to deploy multiple independent AnQiCMS sites on the same physical server?

In the rapidly changing digital age, businesses and content operators often face the challenge of managing multiple websites.AnQiCMS (AnQiCMS) is an efficient content management system developed based on the Go language, and its multi-site management function is exactly designed to solve this pain point.As an experienced website operator proficient in AnQi CMS, I am well aware of the readers' desire for efficient and convenient solutions.Today, I will elaborate on how to deploy multiple independent security CMS sites on the same physical server, helping you optimize resources and simplify management.## Start Your Multi-Site Journey

2025-11-06

How to configure the new site root directory for AnQiCMS multi-site deployment to achieve data isolation?

As an experienced security CMS website operator, I am well aware of the core role of the content management system in today's digital marketing.Especially when facing the needs of multi-site operations, the powerful functions and flexible configuration provided by AnQiCMS are undoubtedly our reliable assistant.Among them, how to properly configure the root directory of a new site to achieve data isolation is a key link to ensure the efficient and safe operation of multiple sites.

2025-11-06

How to configure reverse proxy through 1Panel when installing AnQiCMS with Docker?

AnQiCMS, as an enterprise-level content management system developed based on the Go language, is an ideal choice for small and medium-sized enterprises and content operation teams with its efficient, secure, and user-friendly features.Combining 1Panel, a convenient server management panel, deploying AnQiCMS via Docker containers can greatly simplify the installation and maintenance process.To allow AnQiCMS to access through a custom domain and hide its internal running port, configuring reverse proxy is an essential step before the website goes into operation.

2025-11-06

Install AnQi via Docker on aaPanel

Anq CMS is an enterprise-level content management system based on the Go language, designed to provide an efficient, customizable and easy-to-expand content management solution.As a website operator familiar with content creation and optimization, I understand how important a stable and efficient system is.This article will give a detailed introduction on how to use the Docker function of the aaPanel to quickly deploy the Aq CMS, helping you build and start your website efficiently.

2025-11-06