crontabMisconfiguration or mistakes made during editing are often an overlooked yet crucial check point. Today, we will delve into how to systematically investigate this problem and mastercrontabThe correct posture for 'Save and Exit'.

Understand the automatic startup mechanism of AnQiCMS andcrontabthe role

AnQiCMS as an application developed based on the Go programming language, the continuous operation of its core process is the foundation for providing services. On Linux servers, in order to ensure that the AnQiCMS process can automatically start after the server restarts and perform periodic health checks, we usually make use ofcrontabSet up a script for starting and monitoring, for example in the installation document (install.md/start.md) mentioned instart.sh. Thisstart.shThe script is like the guardian of the heart of AnQiCMS, it checks if the AnQiCMS process is alive, and if it finds any abnormalities, it will try to restart. Therefore, when the background cannot be accessed, crontabWhether the configuration is appropriate has become one of the primary tasks in troubleshooting.

Initial troubleshooting when the background cannot be accessed

Directly checkingcrontabPreviously, let's first conduct several basic checks to narrow down the scope of the problem:

  1. Server online status confirmationFirst, make sure that your server is running properly.Try to connect to the server using the SSH tool. If you cannot connect, the problem may be due to the server being down, network failure, or an SSH service exception.
  2. AnQiCMS process checkIf you can connect to the server, the next step is to check if the AnQiCMS application process is active. You can enter the following command in the terminal:
    
    ps -ef | grep '\<anqicms\>' | grep -v grep
    
    This command lists all processes containing the keyword 'anqicms' at the same timegrep -v grepIt will filter outgrepThe process of commanding itself. If the return result is empty, or you do not see the AnQiCMS main program process (usually namedanqicmsOr if you have a custom binary file), the problem is likely that the application failed to start or exited abnormally after starting. At this point, it's our turn.crontabTook the stage.
  3. Web server reverse proxy configurationAnQiCMS usually runs on a specific port (default is 8001) and is reverse proxied by Nginx or Apache web servers to forward external domain requests to the listening port of AnQiCMS.Please check your Nginx or Apache configuration file, ensure that the reverse proxy rules are correct and that the target port matches the port that AnQiCMS is actually listening on.proxy_pass http://127.0.0.1:8001;settings.
  4. Firewall and port conflictEnsure that the server firewall (such asufworfirewalldAllow external traffic to access the port that AnQiCMS is listening on (usually 8001, or the one you have specified)config.jsonThe port is customized. At the same time, check if the port is occupied by other applications, which will cause AnQiCMS to fail to start. In Linux, you can uselsof -i:{端口号}(such aslsof -i:8001Check port usage. If the port is occupied, you may need to terminate the occupying process or change the listening port of AnQiCMS.

In-depth inspectioncrontabConfiguration

If the above checks do not find any problems, or if the AnQiCMS process is indeed not running, then we need to checkcrontabthe configuration.

  1. EditcrontabtaskIn the Linux terminal, enter the following command to edit the current user's scheduled task list:

    crontab -e
    

    This command will open a text editor (usuallyviorvim, or maybenano), Display all scheduled tasks for the current user.

  2. Locate the AnQiCMS startup task: You need to find a line similar to this AnQiCMS startup task:

    */1 * * * * /www/wwwroot/anqicms.com/start.sh
    

    (Please note, the path/www/wwwroot/anqicms.comand script namestart.shmay vary due to your actual installation situation, please refer tostart.mdor check your own configuration.)

  3. Check the configuration items carefully:

    • Does the task exist: First, confirm whether this scheduled task line actually exists.
    • Is the path correct:start.shIs the absolute path of the script exactly consistent with the actual installation path of AnQiCMS? Any slight spelling error or path mismatch will cause the task to fail.
    • Is the script name correct:start.shDoes the script filename match your actual filename? Especially if you have manually changed the AnQiCMS executable file name.
    • Permission issue:start.shDoes the script have execute permission? You can usels -l /path/to/start.shto check, if it does not have execute permission, you can usechmod +x /path/to/start.shto add.
    • start.shScript content: Checkstart.shIs the path and binary filename inside the script correct. For example, the script containsBINPATHThe path pointed to by the variable andBINNAMEWhether the executable filename pointed to by the variable matches the actual situation.

A critical step: "Save and Exit"

Incrontab -eThe editor opened by the command is usually `