As an experienced website operations expert, I am well aware 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 CMS, providing us with a solid foundation.In the daily system maintenance and troubleshooting, AnQiCMS'sstart.shandstop.shThese service management scripts play a core role. Today, let's delve into where these key scripts usually 'reside' in the AnQiCMS system, as well as their operational logic.
The default destination of AnQiCMS service management script
When deploying AnQiCMS on a Linux server, whether through manual installation via the command line or with the assistance of server management tools such as Baota panel (especially in its outdated deployment methods or non-Go project management mode),start.shandstop.shThese two scriptsThey are stored by default in the installation root directory of AnQiCMS.
This means that they are with the executable file of AnQiCMS main program (usually namedanqicmsThe binary file is closely connected, located in the same folder. For example, if your AnQiCMS project is unzipped and installed in/www/wwwroot/anqicms.com/In the directory, you can usually find 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 main 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 self-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 startup command to bring AnQiCMS back online.
Inside the script, you will find something similar toBINPATH=/www/wwwroot/anqicmssuch variable definitions, which explicitly 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 supply even if you exit the terminal. Therefore, thestart.shPlace in the root directory of the installation, allowing it to be found and executed most directly and convenientlyanqicmsMain program, ensuring the smoothness of the startup process
stop.shGraceful termination of the script and path adaptation
withstart.shThat is complementarystop.shThe script is responsible for executing the graceful shutdown of the AnQiCMS service. When it is necessary to shut down AnQiCMS,stop.shit will go through system commands such asps -ef | grep '\<anqicms\>')Find the process ID (PID) of the AnQiCMS main program and then send a termination signal(kill -9)to close the process.
It is worth noting that,stop.shThe script shows a certain adaptability in path design. It will go throughBINPATH="$( cd "$( dirname "$0" )" && pwd )"This instruction dynamically retrieves the directory where the script 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 on the target process in some cases, even if it is copied to other locations.
considering the position 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:
- Command line manual deployment:This is the most direct scenario, the script is located in the directory where you extracted 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 startup and shutdown of the service for you. It may still call similar logic in the background, but as a user, you usually no longer need to operate these directly.
.shScript, instead, it is managed through Baota's graphical interface. - Docker container deployment:If you choose to deploy AnQiCMS through Docker containers, then
start.shandstop.shThese scripts are usually encapsulated within the internal filesystem of Docker images. The Docker engine is responsible for container lifecycle management, and you will go throughdocker run/docker start/docker stopWait for Docker commands to control AnQiCMS service without directly accessing these scripts on the host machine.
As a website operations staff, understanding the location and basic working principles of these scripts is crucial for daily fault diagnosis, version upgrades, custom service management, and even for fine-tuning performance optimization. In short, AnQiCMS'sstart.shandstop.shScripts are the cornerstone of service management in their Linux deployment environment, by default they are stored in the root directory of the project along with the executable files of AnQiCMS, ensuring the stable operation of the website.
Frequently Asked Questions (FAQ)
Q1: If I change the name of the AnQiCMS executable file,start.shandstop.shcan it still work?
A1: If you changeanqicmsthe name of the executable file, for example, fromanqicmshas been changed tomycms, then you needto edit manuallystart.shandstop.shscriptPlease find all references in the scriptBINNAME=anqicmsand change them toBINNAME=mycmsto ensure that the script can find and manage the correct application process. At the same time,stop.shused in the script to find processesgrep '\<anqicms\>'Part also needs to be updated synchronouslygrep '\<mycms\>'.
**Q2: Deploying AnQiCMS with Docker, I still need to pay attention to `start.