How to troubleshoot if AnQiCMS's `start.sh` or `stop.sh` scripts are incorrectly modified after 'Save and Exit'?

Calendar 👁️ 59

As an experienced security CMS website operations person, I know that every file, especially the key scripts related to system startup and shutdown, carry the responsibility of the normal operation of the website.start.shandstop.shThe script is the 'switch' of this 'building' of AnQiCMS, any abnormality in them may lead to the website being inaccessible or unmanageable.When you accidentally modify these scripts and save and exit, do not panic, a system troubleshooting process will help you restore the service.

Understand the issue: The potential impact of modifying the script

start.shThe script is responsible for starting the AnQiCMS core service process, it usually checks if the process exists, and runs in the background (usingnohupCommand) Run the executable file of AnQiCMS and output the log to the specified file.stop.shThe script is responsible for finding and terminating the running AnQiCMS process.Once these scripts are incorrectly modified, it may lead to a series of problems such as AnQiCMS failing to start, fail to stop, repeatedly starting to produce multiple processes, and even exhausting system resources.

Fault symptom identification

When you find any of the following situations, it may be the case thatstart.shorstop.shScript has encountered an issue:

  • Website is inaccessible:The most direct symptom, the browser prompts connection failure or cannot find the server.
  • No response after attempting to start/stop:After executing the script, the website status did not change, the AnQiCMS process was not started nor stopped.
  • After starting the script, it was still inaccessible, but the system showed that the process existed:This may mean that the AnQiCMS core program failed to load correctly or there is a port conflict.
  • Abnormal system resource usage:There may be multiple AnQiCMS processes running, or a process is consuming CPU or memory abnormally.
  • No update to the log file: running.logorcheck.logNo new records for a long time (if configured).

Initial troubleshooting steps

Before delving into the script content, we can perform some preliminary system status checks.

First, connect to your server via SSH, check if the AnQiCMS process is running. In Linux, you can useps -ef | grep anqicmsCommand. If multiple AnQiCMS processes are found, it may meanstart.shThe script was executed incorrectly multiple times, or the script failed to stop properly.

Secondly, check if the port used by AnQiCMS is occupied. AnQiCMS uses the port by default.8001port. You can use thelsof -i:8001command (to8001Replace with the actual port number used by your AnQiCMS to view port usage. If the port is occupied by another process, AnQiCMS will not start.

Finally, check the AnQiCMS log file.start.shIn the script, the startup log is usually output torunning.logorcheck.log. These log files may contain specific error information for the failure of AnQiCMS startup, such as database connection problems, configuration errors, etc., which helps to narrow down the problem scope.

Detailed script troubleshooting and recovery

When you confirm that the problem may lie instart.shorstop.shthe script itself, the next steps are crucial.

The first step isLocate and back up the current problematic script. Through the SFTP tool or file manager, find the AnQiCMS installation directory understart.shandstop.shthe file. By default, this path may be/www/wwwroot/anqicms/Make sure to copy them and rename them before making any changes to the scriptstart.sh.bakandstop.sh.bakTo prevent irreversible damage due to further operations

The second step isReview the script content. Open with a text editorstart.shandstop.shfile. Refer to the AnQiCMS official documentation (for examplestart.mdand check your script content provided in the examples. Common errors include:

  • Path error: BINPATHThe variable defines the installation path of AnQiCMS,BINNAMEDefined the name of the executable file.If your AnQiCMS is installed in a non-default path or the executable file is renamed, and these two variables in the script are not updated synchronously, it will cause the script to be unable to find the AnQiCMS program.
  • Syntax error:The shell script is very sensitive to syntax. A simple space, newline, or special character mistake can cause the script to fail.
  • Command error: For example,ps -ef | grepin the commandanqicmsThe string may be mistakenly deleted or modified, causing the process to be unable to identify correctly.kill -9The process ID variable in the command may also be destroyed.
  • nohupor&Lost: start.shThe script should usenohup ... &Put the AnQiCMS process into the background and prevent the process from being terminated when the terminal closes.If these commands are missing, AnQiCMS may not start normally or run in the background.

The third step isManually test and recover. If you have found any errors in the script and have made corrections, do not hurry to execute the task scheduler. It is recommended to manually execute the script in the SSH terminal:

  • Manually stop:If AnQiCMS may still be running, first try to execute:./stop.sh. Observe the terminal output, if it prompts successful stop, then use:ps -ef | grep anqicmsThe process has been confirmed to have terminated. If the stop fails, you can try to manually find the process ID (ps -ef | grep anqicms | awk '{print $2}') and usekill -9 <PID>force termination.
  • Manual start:Execute./start.sh.Observe the terminal output. If the script executes successfully, AnQiCMS should start running. Use it againps -ef | grep anqicmsConfirm the process has started. At this time, try to access your website to see if it has returned to normal.

If the script is severely damaged and difficult to repair, the safest method is to obtain a standard version from the official documentation or a known functioning AnQiCMS installation.start.shandstop.shScript, replace the problematic script on your server, then modify the script according to your actual installation path and executable file name, and manually start the test.BINPATHandBINNAMEVariables, and then perform manual startup testing.

Post-event handling and prevention

After AnQiCMS resumes normal operation, you still need to do some post-event work and take preventive measures

first, Reconfirm the task configuration.If during troubleshooting, you disabled the scheduled task for testing, make sure to re-enable or create a Cron task responsible for AnQiCMS automatic startup and shutdown to ensure AnQiCMS can run automatically after server restart.

secondly,Check the website function. Log in to the AnQiCMS backend, confirm that all functions (such as content publishing, image upload, database connection, etc.) are working properly, and ensure that the data is complete and intact.

Finally,Establish good operation and maintenance habits.Always create a backup before modifying any script files in a production environment.Consider using version control tools (such as Git) to manage critical scripts and configuration files.After modifying any configuration or script, it is best to first validate in a test environment or a pre-production environment to ensure that there are no errors before deploying to the production environment.

Even though the above detailed troubleshooting and recovery steps,start.shorstop.shThe script was modified incorrectly, and you can also quickly and effectively solve the problem, ensuring the stable operation of the AnQiCMS website.


Frequently Asked Questions (FAQ)

Q1: I modified the script and saved it, but the website won't open. What should I do?

A1: If the website becomes inaccessible immediately, it is likely that your modification has caused the AnQiCMS service to stop or fail to start. First, connect to the server via SSH to check if the AnQiCMS process is still running (ps -ef | grep anqicmsIf the process does not exist, try to execute manually./start.shAnd check the terminal output and log files (such asrunning.log)to get error information. If the process exists but the website is inaccessible, it may be due to a script causing the service to fail or a port conflict. In this case, you can try to manually execute it./stop.shTerminate the process, then check the logs and restart.If the script content has been severely damaged, it is recommended to restore it as soon as possible using a backup file, or to recreate and modify the path parameters according to the standard script provided in the official documentation.

Q2: Have I restored the script content, but AnQiCMS still cannot start? Are there other possible reasons?

A2: Even if the script content is restored, there may be other reasons why AnQiCMS cannot be started. You can check the following points:

  • Port conflict:Even if the script itself is fine, the 8001 port used by AnQiCMS by default may be occupied by other applications. Uselsof -i:8001Check the port occupancy status, if occupied, you can try to terminate the occupying process or modify the AnQiCMS'sconfig.jsonservice port change.
  • Permission issue:Ensure that the executable files, script files, and log directories of AnQiCMS have the correct execution and write permissions.
  • Insufficient system resources:The server's memory or CPU resources may be exhausted, which may also cause the service to fail to start. Check the system resource usage.
  • Other configuration errors: config.jsonOr other AnQiCMS internal configuration files may contain errors. Check in detailrunning.logorcheck.logThey usually record more specific startup failure reasons.
  • Database issue:The database service is not running or there is a connection configuration error, which may also cause AnQiCMS to fail to start. Please check the status of MySQL and other database services.

Q3: How should I backup?start.shandstop.shscript?

A3: It is very simple and important to back up these key scripts. The most direct method is to copy them before making modifications throughcpcommands and add.baksuffix:

  • cp /www/wwwroot/anqicms/start.sh /www/wwwroot/anqicms/start.sh.bak
  • cp /www/wwwroot/anqicms/stop.sh /www/wwwroot/anqicms/stop.sh.bakIt is better to regularly backup the entire AnQiCMS installation directory, or use a version control system (such as Git) to manage these files for easy tracking of changes and quick rollback.At the same time, ensure that these backup files are stored in a safe location outside the server to prevent server failure.

Related articles

After modifying the AnQiCMS template file (.html), does "Save and Exit" require manually clearing the cache or restarting the service to display updates on the front end?

As a senior CMS website operator for a security company, I know that the timeliness of content and the display effect are crucial to user experience.The template file serves as the skeletal structure for presenting website content, and the update mechanism after modification is a common concern for operators.About AnQiCMS template files (.html) after modification and 'Save and Exit', whether it is necessary to manually clear the cache or restart the service to display the update on the front end, a detailed elaboration can be given according to my long-term understanding and practice of AnQiCMS

2025-11-06

After modifying the reverse proxy configuration of Apache or Nginx, what commands need to be executed after performing the "Save and Exit" operation to make the AnQiCMS site accessible?

When managing the AnQiCMS site, you may need to adjust the reverse proxy configuration of Apache or Nginx according to your requirements.These configuration modifications, whether it is to change the domain name, port mapping, SSL certificate settings, or optimize performance rules, require specific operations to take effect on the web server.Saving and exiting the configuration file will not immediately make your site run normally. The web server needs to be informed of these changes and reload the configuration.

2025-11-06

How to replace the manual 'save and exit' with the container restart rules (such as 'restart on failure') when deploying AnQiCMS with Docker to ensure high availability?

As a professional who is well-versed in the operation of AnQiCMS, I understand the importance of the stable operation of a content management system, which directly relates to the efficiency of content publishing, user experience, and the overall business performance of the website.In modern website architecture, Docker has become a powerful tool for deploying AnQiCMS, and one of its core advantages is the container restart strategy, which not only replaces the繁琐 of traditional manual operations but also is the foundation for high availability.### From manual operation to intelligent restart: The innovation of operation and maintenance mode Before the popularity of Docker technology

2025-11-06

How does the 'save and exit' mechanism ensure service persistence after checking 'start on boot' in the 'Go project' on the Baota panel and configuring AnQiCMS?

As a website manager who deeply understands the operation of Anqi CMS, I understand your concerns about service persistence and website stability.In the "Go projectAnQiCMS as an enterprise-level content management system developed based on the Go language has laid a solid foundation for the stability of the service.

2025-11-06

How to modify the Markdown editor settings in the AnQiCMS backend and exit 'Save and Exit' to make the new settings effective when content is published?

As an expert in the operation of AnQiCMS, I fully understand the significance of efficient content creation tools for the success of a website.The Markdown editor is increasingly favored by content creators for its concise and efficient features.AnQiCMS deeply integrates Markdown editor and provides rich extension features, making your content publishing more convenient.

2025-11-06

After the 'site-wide content replacement' feature is executed, will these batch changes be immediately applied to all pages upon completion and 'save and exit'?

In the daily operation of AnQi CMS, efficient content management and quick updates are the key to improving website quality and user experience.The "Full Site Content Replacement" feature was born for this purpose, aiming to provide the ability to batch process website content.After the function is executed, whether these batch changes are immediately applied to all pages after the operation is completed, that is, after 'save and exit', let us analyze in detail.The 'Full Site Content Replacement' of AnQi CMS is positioned as a core advantage feature, which allows operators to 'replace keywords or links on the entire site with one click, supporting batch updates of content'

2025-11-06

Can the 'Update Cache' function in AnQiCMS backend be understood as a forced refresh of the content that has not taken effect immediately after the 'Save and Exit' file operation?

As an operator who is deeply rooted in AnQiCMS, I know that the timeliness of content updates is crucial for user experience.You have raised a very common and crucial question about whether the 'Update Cache' function on the AnQiCMS backend can be understood as a forced refresh of the content that is not immediately effective after 'Save and Exit'.In short, the answer is affirmative. ### Cache Mechanism and Performance Optimization in AnQiCMS AnQiCMS, as an enterprise-level content management system developed based on Go language, one of its design philosophies is to provide efficient

2025-11-06

After deploying AnQiCMS via command line in `install.md`, how to check for syntax errors when adding a scheduled task and saving/closing the crontab file?

As an experienced security CMS website operator, I am well aware of the importance of a stable and efficient content publishing process for the website.Among them, correctly configuring the plan task is the key link to ensure the smooth operation of the core functions of AnQiCMS (such as scheduled publishing, content collection, statistical updates, etc.).When deploying AnQiCMS in a command-line environment and configuring the `crontab` schedule task, it is a skill that every operator must master to ensure the syntax is correct and the task executes as expected.

2025-11-06