AnQiCMS as an efficient and lightweight content management system, its stable operation is the foundation of website operation.However, during use, there may occasionally be a situation where the system frequently restarts or abnormally stops, which undoubtedly poses a great challenge to the availability of the website.When this kind of problem arises, you may feel somewhat anxious and not know where to start.crontab(Scheduling tasks) are often the first place we need to examine, as they are responsible for the continuous operation and monitoring of the AnQiCMS core process.

AnQiCMS's deployment documentation clearly states that on Linux servers, it is usually throughcrontabconfigure a task to run once a minute,start.shScript, to ensure the survival of the AnQiCMS process.The purpose of this script is to check if AnQiCMS is running, and if not, restart it.crontabThe related startup scripts have become the primary target for troubleshooting.

1. Checkcrontabwhether the entry itself is sound

Firstly, we need to confirmcrontabDoes it exist a startup task for AnQiCMS, and is the configuration correct? You can input it in the terminal.crontab -eCommand to edit the current user's task list. Typically, you will see a configuration line similar to the following:

*/1 * * * * /www/wwwroot/anqicms.com/start.sh(or the actual path to your AnQiCMS)

Here are several key points that need to be checked:

  • Does the task exist?Ensure that the startup task entry for AnQiCMS is not accidentally deleted or commented out.
  • Execution frequency: */1 * * * *This indicates executing once every minute, which is the standard configuration for AnQiCMS to maintain its activity.If this is modified to an unreasonable frequency, it may affect its 'watchdog' effect.
  • Script path: /www/wwwroot/anqicms.com/start.sh(or your own path) must bestart.shof the scriptAbsolute path, and make sure that this path is real. An incorrect path will lead tocrontabIt's impossible to find the script, so the startup task cannot be executed naturally.

It is also worth noting that,crontabThe task is executed for a specific user. If you are a different user (for example,rootUsers orwwwUsers)deployed AnQiCMS, then you may need to check the corresponding user'scrontabconfiguration. You can replace it with the actual user) to view.sudo crontab -e -u username(ReplaceusernameReplace it with the actual user) to view.

2. Deep checkstart.shThe content of the script and permissions

ConfirmcrontabAfter the entry is correct, the next step is to checkstart.shThe script itself. This script is the actual manager of the AnQiCMS process, and any issues within it may directly lead to system instability.

  • Script execution permission:Ensurestart.shScript has execution permissions. You canls -l /path/to/start.shCommand view permission, usually it should containxpermissions (for example 翻译结果)-rwxr-xr-x。如果缺少,请使用chmod +x /path/to/start.shcommand add execute permission。
  • Internal variable configuration:Openstart.shFile, you will see something likeBINPATHandBINNAMEsuch variable definition.
    
    BINNAME=anqicms
    BINPATH=/www/wwwroot/anqicms # 需要改成你的站点的实际真实路径
    
    Make sure to checkBINPATHwhether it accurately points to the installation directory of AnQiCMS, as well asBINNAMEIs the name of the actual AnQiCMS executable file consistent with you (especially when you may have manually renamed the executable file)?Any minor error may cause the script to fail to correctly locate and start the AnQiCMS process.
  • Check the script log: start.shThe script will output its own runtime log tocheck.logandrunning.logthe file. These logs are valuable clues to failures:
    • check.log:It will recordcrontabEach time it is executedstart.shThe check result of the AnQiCMS process. If 'AnqiCMS NOT running' appears frequently here, followed by logs showing the process starting, it indicates that the AnQiCMS process is continuously crashing.crontabJust keep trying to pull it up.
    • running.log:This file contains the output and error information of the AnQiCMS application. Ifcheck.logDisplay AnQiCMS is being frequently restarted,running.log几乎肯定会记录 AnQiCMS 崩溃的具体原因,例如 database connection failure、configuration error、resource exhaustion 等。Carefully analyze the error stack or warnings here, usually you can directly locate the root problem.

3. Exclude AnQiCMS running environment and its own problems

even ifcrontabandstart.shThe script itself appears to be working fine, but if AnQiCMS is still unstable, the problem may lie in the AnQiCMS running environment or the application itself. Although these are notcrontabthe direct question, butcrontabThe frequent restarts of the report are often the "symptoms" of these problems:

  • Port occupied:AnQiCMS runs by default on port 8001 (inconfig.jsonConfiguration).If another program on the server is using this port, AnQiCMS will not be able to start. You can uselsof -i:{端口号}[for example]lsof -i:8001)Command to check port occupancy situation.If the port is occupied, you may need to terminate the occupying process, or modify the port configuration of AnQiCMS and update the relevant reverse proxy settings.
  • Database connection issues:AnQiCMS depends on MySQL database.If the database service is not running, the connection information (such as password, host address) is configured incorrectly, or the database user does not have sufficient permissions, AnQiCMS will not run normally.config.jsonor related database configuration), and ensure the database service is running healthily.
  • Server resource limit:Insufficient memory (OOM Killer), high CPU usage, or disk space exhaustion may all lead to the termination of the AnQiCMS process by the system.Regular monitoring of server resource usage is necessary.
  • File permission issues:Exceptstart.shAnQiCMS running process also needs to read and write log files, cache files, uploaded files, etc.If these directory or file permission settings are incorrect, it may also lead to AnQiCMS running abnormally.

Through this systematic check, you can usually gradually narrow down the scope of the problem, ultimately locating the root cause of frequent restarts or abnormal stops of AnQiCMS. Remember,crontabJust a scheduler, its 'frequent restarts' often tell us that the application itself is encountering difficulties.


Common Questions (FAQ)

Q1:crontabThe log shows that the AnQiCMS process “NOT running” starts immediately again, but the website still cannot be accessed or displays an error, why is that?

A1:This indicatescrontabThe task is being executed as expected, but the AnQiCMS application crashed soon after startup. At this point, you should check immediately.start.shScript-generatedrunning.logFile.This log file records all outputs and error information during the startup process of the AnQiCMS application, which is likely to directly reveal the specific cause of the application crash, such as database connection failure, configuration error, memory overflow, or other internal logic errors.

**Q2: I modified `config.'