AnQiCMS as an efficient and customizable enterprise-level content management system, its stable operation is the foundation of website operation.Understanding the internal operation mechanism and diagnostic tools is crucial during the deployment and maintenance of AnQiCMS.crontabGenerated in the configurationrunning.logA file, as a highly diagnostic 'black box', records the startup status and critical information of the core services in the early stages of operation. As an experienced website operations expert, I will take you for an in-depth analysisrunning.logThe diagnostic value, helping you better master AnQiCMS.
AnQiCMS background task mechanism andrunning.logthe birth of
in the AnQiCMS running environment,crontabacting as a crucial "backstage manager" role. According to the AnQiCMS installation document, in order to ensure the continuous and stable operation of the core service (i.e., the execution program of AnQiCMS), the system willcrontabConfigure a scheduled task that runs every minute. This task will periodically call a script namedstart.sh.
start.shThe core logic of the script is to check if the AnQiCMS program is already running.If the program is not running, it will attempt to start the executable file of AnQiCMS.nohup $BINPATH/$BINNAME >> $BINPATH/running.log 2>&1 &. This command cleverly accomplishes several things:
nohup: Ensure that the AnQiCMS process continues to run even if the terminal session is closed.>> $BINPATH/running.log: Redirect all standard output (stdout) generated by AnQiCMS during execution torunning.logthe file.2>&1: Redirect standard error output (stderr) to the same place as standard output, i.e.running.logThis means that any error messages encountered by the program at startup or in the initial running phase will be recorded in this file.&: Let AnQiCMS process run in the background without blocking.start.shThe execution of the script.
Therefore,running.logNot a simple operation log, it is a window of 'self-expression' for the AnQiCMS core program during its startup and early operation, recording its 'heartbeat' and possible 'discomforts'.
running.log:Diagnosis website health status with a 'stethoscope'
running.logThe file contains rich diagnostic information and is a key clue source for solving AnQiCMS operation failures:
1. Core service startup failure of the 'Scout'
When your AnQiCMS website is inaccessible, the first thing to suspect is whether the core service is started normally.running.logThis has provided valuable insights in this matter:
- Database connection issues:If the database configuration is incorrect (such as incorrect username, password, or address), or if the database service itself fails to start normally, any error messages generated by AnQiCMS when trying to connect, such as 'Unable to connect to database', 'Authentication failed', etc., will be captured.
running.logThis can quickly locate the problem in the backend data layer. - Configuration parsing error:AnQiCMS
config.jsonThe file carries many core settings of the website. If the file format is incorrect, missing key configuration items, or the values are not valid, AnQiCMS will fail to parse the configuration at startup, and the corresponding error messages will be clearly printed.running.logauto, for example “JSON parsing failed”, “Invalid port number” and so on. - Port conflict:AnQiCMS defaults to using port 8001. If another service is already using that port on the server, AnQiCMS will be unable to bind to the port and the startup will fail.
running.logRecords errors similar to 'Address already in use', 'Port binding failed', to help you find port conflicts. - File permission issues:AnQiCMS program needs to have read and write permissions for certain directories (such as log directories, upload directories). If the permission settings are incorrect, the program may encounter obstacles when accessing these resources at startup, and error messages related to permissions will be recorded.
running.log.
2. Runtime exception of the "alarm"
Althoughrunning.logMainly focuses on the startup process of the program, but if AnQiCMS encounters serious errors and crashes shortly after startup, or if some core modules appear abnormal in the early stages of operation, the output information will also be redirected torunning.logThis includes:
- Out of memory or resources exhausted:Although not common, if AnQiCMS is unable to start due to incorrect configuration or excessive load, some Go runtime error messages may be recorded.
- Third-party service connection failed:For example, if AnQiCMS integrates the email sending feature, but the email server configuration is incorrect or inaccessible, related connection errors may be output during the first attempt to send an email.
running.log. - Internal logic error:If it is a serious bug in the AnQiCMS code that causes the program to crash, some panic stack information in the Go language may also be recorded, providing developers with debugging clues.
3. Configure the 'feedback loop' for verification and adjustment
After configuring AnQiCMS, such as modifying the static resource path, image processing methods, etc., although these are not errors that directly cause the program to crash, if the configuration values do not meet expectations, the AnQiCMS program may print warnings or prompts when starting. Byrunning.logWe can confirm whether the new configuration is loaded and recognized correctly, and check for any potential configuration conflicts or misunderstandings.
running.logWithcheck.logsynergistic effects
In AnQiCMScrontabplan, in addition torunning.logwe will also seecheck.logThese two have similar functions but focus on different aspects, used together can provide a more comprehensive diagnostic view:
check.logRecords arestart.shThe execution status of the script.It records when the script is executed, the PID check result of the AnQiCMS process (whether it exists), and whether the script attempts to restart the AnQiCMS program.check.logUnderstood as the 'night watchman'打卡record and patrol report.running.logRecords are AnQiCMSThe application itselfThe output and error messages. It is the 'physical examination report' of the application, detailing how it was doing when it started and where the problems were.
In simple terms, if you find that the AnQiCMS website is not working:
- First check
check.logto confirmcrontabwhether the task is running normally, as well asstart.shwhether the script is trying to start AnQiCMS. - If
check.logdisplaystart.shThe website is still not responding while repeatedly trying to start AnQiCMS, so the next step should be to check immediatelyrunning.log。It will tell you why AnQiCMS cannot start successfully or why it crashes soon after starting.
By combining these two log files, you can quickly distinguish whethercrontabSchedule task issue itself (such as not executedstart.sh), or AnQiCMS application itself issue (such as configuration error, database connection failure, etc).
How to make use ofrunning.logPerform effective diagnosis
Masteredrunning.logThe value, next is how to effectively use it:
- Real-time monitoring:Use
tail -f /path/to/anqicms/running.logCommand, you can view the latest log content in real time. When you try to restart AnQiCMS or perform certain operations, you can observe the dynamic output of the log to immediately identify any issues. - Keyword search:Use when the website has issues:
grepthe command isrunning.logSearch for keywords, for example:error/