As an experienced website operations expert, I know that a highly efficient and stable content management system (CMS) is crucial for the successful operation of a corporate website.AnQiCMS with its lightweight and efficient Go language stands out among many CMSs, providing us with a solid foundation.start.shandstop.shThese two service management scripts play a core role.Today, let's delve into where these two key scripts usually 'reside' in the AnQiCMS system and the operational logic behind them.

English service management script of AnQiCMS default destination

When you deploy AnQiCMS on a Linux server, whether you install it manually via the command line or with the assistance of server management tools like Baota panel (especially in its old deployment methods or non-Go project management mode),start.shandstop.shThese two scriptsThe default installation path of AnQiCMS.

This means that they are executable files of AnQiCMS main program (usually a file namedanqicmsThe binary file) is closely connected and located in the same folder. For example, if your AnQiCMS project is unpacked and installed/www/wwwroot/anqicms.com/Under the directory, you usually find it at this path.start.shandstop.shScripts that quietly wait to be called to start or stop services.

start.shThe working principle of the scripts is associated with their location.

start.shThe primary responsibility of the script is to ensure that the AnQiCMS service runs continuously and stably. It is usually integrated into the system's scheduled tasks (such as Linux'scrontabIn order to achieve the automatic startup and process guardianship of the service.This script will regularly check if the AnQiCMS main program is running.If the service is detected to have stopped, it will immediately execute the start command, bringing AnQiCMS back online.

Inside the script, you will find something similar toBINPATH=/www/wwwroot/anqicmsSuch variable definitions, which clearly indicate the storage path of the AnQiCMS executable file. Subsequently, it will usenohupThe command starts the AnQiCMS binary file in the background, ensuring that the service continues to provide a stable and continuous operation even if you exit the terminal. Therefore,start.shPlace in the installation root directory, able to find and execute directly and convenientlyanqicmsMain program, ensuring the smoothness of the startup process.

stop.shGraceful shutdown of the script and path adaptation

Withstart.shThey complement each other.stop.shScript, its task is to perform an elegant shutdown of the AnQiCMS service. When it is necessary to close AnQiCMS,stop.shit will use system commands (such asps -ef | grep '\<anqicms\>')Find the process ID (PID) of the AnQiCMS main program and then send the termination signal (kill -9)to close the process.

It is worth noting that,stop.shThe script exhibits certain path adaptability in design. It willBINPATH="$( cd "$( dirname "$0" )" && pwd )"Such instructions, dynamically obtain the directory where it is located.This design further emphasizes the default assumption of coexistence with the AnQiCMS main program file, and allows the script to accurately find and operate the target process in some cases, even if it is copied to other locations.

consider location under deployment mode

Althoughstart.shandstop.shThe default location is the installation root directory, but different deployment methods may vary in how directly you perceive them:

  • Manual deployment via command line:This is the most direct scenario, the script is located in the directory where you unzip AnQiCMS.
  • Baota panel (Go project mode):In the newer versions of Baota panel, when you use its 'Go project' feature to deploy AnQiCMS, Baota panel will automatically manage the start and stop of services for you. It may still call similar logic at the bottom level, but as a user, you usually no longer need to directly operate these.shScript, rather than through the 宝塔 graphic interface for management.
  • Docker container deployment:If you choose to deploy AnQiCMS through Docker container,start.shandstop.shThese scripts are usually encapsulated in the internal file system of Docker images. The Docker engine is responsible for container lifecycle management, and you willdocker run/docker start/docker stopControl AnQiCMS service using Docker commands, without directly interacting with these scripts on the host machine.

As a website operator, understanding the storage location and basic working principle of these scripts is crucial for daily troubleshooting, version upgrades, custom service management, and even for performing more fine-grained performance tuning. In short, AnQiCMS'sstart.shandstop.sh脚本是其Linux部署环境下的服务管理基石,它们默认与AnQiCMS的可执行文件一同存放在项目的根目录,共同保障着网站的稳定运行。


Common Questions and Answers (FAQ)

Q1: If I changed the name of the AnQiCMS executable file,start.shandstop.shCan it still work normally?

A1: If you change theanqicmsname of the executable file, such as changing it fromanqicmstomycmsthen you needManual editstart.shandstop.shscriptFind all references in the scriptBINNAME=anqicmswhere,BINNAME=mycmsto ensure the script can find and manage the correct application processes. At the same time,stop.sh脚本中用于查找进程的grep '\<anqicms\>'部分也需要同步更新为grep '\<mycms\>'.

**Q2: 通过Docker部署AnQiCMS,我还需要关心`start.