How to verify that the AnQiCMS service can automatically start after saving and exiting the `start.sh` script added to crontab?

Calendar 👁️ 66

The AnQiCMS service auto-start verification method

It is crucial to ensure that core services can run stably and automatically in website operation. For AnQiCMS, it is necessary tostart.shscript tocrontabIt is to automatically restore its running status after the system starts up or the service stops unexpectedly, ensuring the continuous availability of the website. Completedstart.shConfigure the script and add it tocrontabAfter, the detailed verification steps are the key to ensuring that this automation mechanism works as expected.

Firstly, we need to understandstart.shscripts andcrontabThe collaborative working style. According to the AnQiCMS installation document,start.shThe script is designed to check if the AnQiCMS process is running. If it detects that the service is not running, it will execute the start command and throughnohupand run in the background&Ensure the service continues to run after the session is disconnected and logs the output torunning.logthe file. Additionally,check.logthe file records the script's check status.crontabIt is a time-based task management tool for Linux/Unix systems, which executes periodically at predefined intervals (such as once a minute)start.shScript to implement automatic monitoring and startup of AnQiCMS service.

Verify that the AnQiCMS service can automatically start, requiring a series of systematic and simulation tests.

The first step of the verification is to confirm.crontabIs the entry itself correctly set. Enter in the server command linecrontab -eCheck if you can find something similar*/1 * * * * /www/wwwroot/anqicms/start.shThe entry. Pay special attention to whether the script path is consistent with the actual installation path of AnQiCMS, as well asanqicmsIs the name of the executable file matching, because the installation document mentions that the executable file name may be renamed. Any mismatch in the path or filename may lead tocrontabUnable to execute the script correctly.

Next, you can try to run it manually.start.shScript to observe its immediate behavior. Run it directly in the AnQiCMS installation directory../start.sh. Observe the command line output, althoughnohupRedirect most of the output to the log file, but the script may have brief prompts. More importantly, check the process status of the AnQiCMS service immediately.

To check if the AnQiCMS service has started successfully, you can useps -ef | grep anqicmsCommand. This command lists all processes containing the keyword 'anqicms'.If you see the AnQiCMS process running along with related startup parameters, it indicates that the service has been started at the operating system level.Additionally, throughlsof -i:{端口号}commands (for examplelsof -i:8001,AnQiCMS default port is 8001), you can verify whether AnQiCMS is listening on its configured port.If the port is correctly monitored, the service usually can respond to network requests.

After confirming that the service process and port status are normal, access the AnQiCMS front-end and back-end management interface via a web browser (http://你的域名andhttp://你的域名/system/). This is the most intuitive user-level verification, confirming that there are no abnormalities in the website functions and background operations, representing that the AnQiCMS service is fully operational.

In order to truly verifycrontabThe automatic startup capability needs to simulate a service failure situation. Throughps -ef | grep anqicmsFind the PID of the AnQiCMS process and then usekill -9 {PID}command to force terminate the process. After termination, use it again immediatelyps -ef | grep anqicmsConfirm that the process does not exist. Then, wait for at least one minute, allowingcrontaban opportunity to executestart.shthe script. One minute later, repeat the executionps -ef | grep anqicmsandlsof -i:{端口号}Try accessing the AnQiCMS website again through the browser. If the service restarts and is accessible, it provescrontabthe automatic startup mechanism is working properly.

Finally, checkstart.shLog files generated by scripts are an effective way to troubleshoot issues and can also further confirm the details of automatic startup. Look for them in the installation directory of AnQiCMS.check.logandrunning.logfile.check.logit will recordcrontabEach time the script is executedstart.shThe script checks the process status of AnQiCMS, including whether the service is running, PID check, etc.running.logIt will record the standard output of AnQiCMS service, if there are errors or output information when the service starts, they are usually found here.By checking these logs, you can understand the historical record and potential issues of service startup.

By going through the aforementioned multi-dimensional and systematic verification steps, it can comprehensively confirm that AnQiCMS is incrontabUnder configuration, it has reliable automatic startup capabilities, thus providing a solid guarantee for the stable operation of the website.


Frequently Asked Questions (FAQ)

  • Q1: I have already addedstart.shtocrontabBut AnQiCMS still does not automatically start, why is that?A1: There may be multiple reasons for this problem. First, checkcrontab -eIs the script path correct, make surestart.shThe file exists and has execute permission(chmod +x start.sh) Next, checkstart.shThe script internally definedBINPATHandBINNAMEWhether it is consistent with the actual executable file path and name of AnQiCMS. In addition, checkcheck.logandrunning.logFile, these logs record the execution status of the script and potential error information, helping you locate the problem. Port conflict is also a common cause, please uselsof -i:{端口号}Check if the port configured for AnQiCMS is occupied by other programs.

  • Q2: How to viewstart.shIs the scriptcrontabexecuted normally?A2: The most direct method is to viewstart.shScript-generatedcheck.logFile. Each timecrontabWhen the script is triggered to execute,check.logit will record the timestamp and the check status of the AnQiCMS process. Ifcheck.logthere is no update, it meanscrontabMay not be working, you can checkcrontabIs the service itself running (for examplesystemctl status cronorservice cron status), or is there an environment variable issue causing the script to not find the correct command.

  • Q3: If the process of AnQiCMS service iskill -9forcefully terminated, can it still automatically start?A3: Yes, that iscrontabcooperatestart.shOne of the purposes of script design. After the AnQiCMS process is forcibly terminated, incrontabthe next executionstart.shWhen the script is running, the script will detect that the AnQiCMS process does not exist and will then execute the startup command again to restart the service. As long ascrontabthe configuration is correct andstart.shThe script can run normally, and the service can automatically recover after being terminated.

Related articles

If the "ws save and exit" mentioned in the AnQiCMS document is a typo for `wq`, what is the difference between `wq` and `x` in Vim for saving and exiting?

As an experienced security CMS operator in the field of content management for many years, I fully understand the importance of every detail to the efficiency of content work, whether it is the content creation itself or the technical operations behind it.When dealing with template files, optimizing content snippets, or configuring system scripts, we often deal with various command-line tools, and Vim editor is one of them.

2025-11-06

How to correctly execute 'Save and Exit' after modifying the scheduled task of AnQiCMS on a Linux server to ensure the task takes effect?

As an experienced CMS website operation personnel of an information security company, I am well aware of the importance of managing scheduled tasks on Linux servers for system stability and automated operation and maintenance.When you need to adjust the Anqin CMS schedule task, whether it is to schedule the application to start, execute the data backup script, or handle other custom automation processes, ensuring that the modified task takes effect correctly is crucial.This process usually involves the Linux system's `crontab` tool and the correct operation of its built-in editor.###

2025-11-06

What is the Vim/Vi operation referred to by "ws save and exit" in the `crontab -e` command?

## Parsing the "ws save and exit" operation in the `crontab -e` command When deploying and maintaining AnQi CMS, the `crontab -e` command is a common command used to edit system scheduled tasks to ensure the continuous operation of the website service and the automation of maintenance tasks.In the AnQiCMS deployment document, we noticed that when editing the `crontab` task, the prompt information appeared with the text "# ws save and exit".This may confuse some users who are new to or not familiar with Vim/Vi editors

2025-11-06

How to create and manage content models in AnQiCMS and

As an experienced security CMS website operations personnel, I am well aware of the importance of flexible content management for the successful operation of a website.AnQi CMS with its powerful content model function provides a solid foundation for us to meet diverse content needs.Next, I will elaborate on how to create and manage content models in AnQiCMS, so that you can efficiently build and publish various types of content. ### Understanding the Content Model in AnQi CMS In AnQi CMS, the content model is the core for defining the structure of specific types of content.

2025-11-06

What are the correct steps to 'save and exit' after modifying the 'config.' file in AnQiCMS, and do you need to restart the service?

As a professional who deeply understands the operation of AnQiCMS, I know the importance of modifying the configuration file for system stability and functional implementation.When you modify the `config.` file of AnQiCMS, the correct operation procedure and understanding of service restart are the key to ensuring that changes take effect and avoid potential risks.The `config.` file is typically located in the root directory of the AnQiCMS installation, which is the core configuration file.This file carries the basic settings for the AnQiCMS application running

2025-11-06

What is the complete procedure for saving and exiting the configuration and making the new port effective after modifying the `port` port of each site in the multi-site configuration?

As an experienced CMS website operation personnel of AnQi, I fully understand the importance of multi-site management for efficient operation.When you need to deploy multiple independent AnQiCMS instances on the same server and want each instance to listen on a different port, it indeed requires a clear operation process.Let's go through it in detail on how to modify the port for each AnQiCMS site and make it effective.### Understanding the differences between multi-site and multi-instance Before we begin, we need to clarify the two types of "multi-site" modes supported by AnQiCMS

2025-11-06

Does clicking 'Save' in the AnQiCMS backend after modifying system settings or content settings equivalent to 'Save and Exit' at the file level and take effect immediately?

As an experienced CMS website operation person in the security industry, I know that an accurate understanding of system behavior is crucial for efficient operation when performing operations in the background.About the issue you raised, "AnQiCMS" background modification of system settings or content settings, after clicking "Save", is it equivalent to "Save and Exit" at the file level and take effect immediately?This issue can be explored in detail from several aspects.In the daily operation of Anqi CMS, the "Save" button on the backend usually executes the operation of writing data to the database.Whether we updated the content of an article or adjusted the description of a category

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