How to verify whether the `start.sh` script of AnQiCMS is effective after it is configured in `crontab`?

Calendar 👁️ 69

Protect AnQi CMS: How to validate elegantlystart.shScript incrontabIs it working normally?

AnQiCMS (AnQiCMS) is an efficient content management system developed based on the Go language, which has won the favor of many small and medium-sized enterprises and content operators due to its easy deployment and fast operation. In order to ensure that your AnQiCMS site can run stably and continuously, even in the face of sudden situations or server restarts, we usually will start and guard the core program responsible for starting and maintaining the program.start.shConfigure the script to the Linux system's scheduled taskcrontab.

However, merely adding the script tocrontabIt does not mean everything is fine. As an experienced website operation expert, I fully understand the importance of verification work. This article will delve into how to systematically checkstart.shScript incrontabIs the configuration truly effective, ensure that your security CMS is always online.

Understand the "Guardian":start.shwithcrontabCollaborative work

Before we delve into verification, it is necessary to understand first.start.shThe working principle of the script and its interaction withcrontab.

According to the AnQiCMS deployment document,start.shThe script is designed very cleverly, it does not simply start the AnQiCMS program, but will undergo a 'physical examination' before it starts:

# check the pid if exists
exists=`ps -ef | grep '\<anqicms\>' |grep -v grep |wc -l`
...
if [ $exists -eq 0 ]; then
    echo "$BINNAME NOT running"
    cd $BINPATH && nohup $BINPATH/$BINNAME >> $BINPATH/running.log 2>&1 &
fi

This core code indicates,start.shIt will first check if the process namedanqicmsis running. If the process does not exist(exists -eq 0), it will truly executenohup $BINPATH/$BINNAME >> $BINPATH/running.log 2>&1 &the command to start AnQiCMS and redirect all output torunning.logfile, running in the background.

AndcrontabThe function is to call this at the time interval you set (usually once a minute, for example)*/1 * * * * ...), call this at regular intervals.start.shScript. So, even if the AnQiCMS program crashes unexpectedly,crontabit will detect that it is not running in the next minute and will automatically restart, thus achieving the "guard" effect. At the same time,start.shIt will also record a brief information of each check and startup attempt.check.log.

Understanding this, our verification work has a clear direction.

Verification journey: Step by step to confirm effectiveness.

Next, we will verify in detail through a series of stepsstart.shScript incrontabof the running status

First step: ConfirmcrontabThe existence and correctness of the task itself

Firstly, we need to checkcrontabDid you really addstart.shthe script task and is the path correct.

You can list all scheduled tasks of the current user by enteringcrontab -lcommands in the terminal. If your task is torootThe user configured, it may be necessary to usesudo crontab -l.

Carefully check the output results to ensure that it contains something similar to*/1 * * * * /www/wwwroot/anqicms.com/start.sh(Please adjust the entry according to your actual installation path).If the path is incorrect, AnQiCMS will not be guarded correctly.crontab -eEnter the editing interface to correct

Second step: CheckcrondThe running status of the service

crontabThe execution of the task depends oncrond(orcron) service. If this service is not running, then your scheduled task will not be executed naturally.

You can use the following command to checkcrondthe status of the service:

  • For Systemd systems (such as CentOS 7+, Ubuntu 16.04+):systemctl status cronorsystemctl status crond
  • For SysVinit systems (such as CentOS 6):service cron statusorservice crond status

Ensure that the service status is displayed asactive (running)Or similar. If the service is not running, you need to start it, for example:sudo systemctl start cron.

Step 3: Reviewstart.shScript execution log

This is verificationcrontabWhether the call was successfulstart.shthe most direct evidence.start.shThe script will output a brief log of each execution tocheck.logthe file.

Go to the installation directory of your AnQiCMS undercheck.logfile (for example/www/wwwroot/anqicms.com/check.log), usingtail -f check.logCommand to view the content of the file in real time:

tail -f /www/wwwroot/anqicms.com/check.log

You should be able to see a new log entry added every minute, displaying:anqicms PID check:This indicates:crontabIndeed, it is calling at regular intervals:start.shscript. IfexistsThe value shows as0This means that the AnQiCMS program was not running when the check was performed, and the script tried to start it; if it shows as1This indicates that AnQiCMS is running normally.

Step 4: Verify the survival status of the AnQiCMS process

Just knowcrontabThe script has been called, but we still need to confirm whether the AnQiCMS program itself is really running.

You can useps aux | grep anqicmscommand to view all processes related toanqicms: related processes:

ps aux | grep anqicms

In the output results, you should be able to find one or moreanqicmsprocesses, and their status should beRunning. If you only seegrep anqicmsitself, it means that the AnQiCMS program has not started.

Additionally, since AnQiCMS usually listens on a specific port (default as 8001),You can also verify that the program is providing services to the outside world by checking the usage of the port:

lsof -i:8001

If the command returns process information listening to the port, and the process name isanqicmsThis means that AnQiCMS is running and listening for network requests. If the return result is empty, or the process is notanqicmsThere may be a port conflict or the program has not started.

Step 5: Insight into AnQiCMS runtime logs

Ifcheck.logThe script is called,ps auxThe process is running, but the website still cannot be accessed, which may be that AnQiCMS itself encountered a problem when starting up. At this time,running.logit becomes our 'diagnosis'.

start.shThe script will redirect both the standard output and error output of the AnQiCMS program torunning.logfile (for example/www/wwwroot/anqicms.com/running.log)

Usetail -f running.logCommand to view the contents of the file:

tail -f /www/wwwroot/anqicms.com/running.log

This records the detailed information during the startup and operation of AnQiCMS.Any startup failure messages, such as database connection issues, configuration errors, insufficient permissions, etc., will be displayed here.By analyzing these logs, you can locate and solve the problems of the AnQiCMS program itself.

Step 6: Simulate a fault to verify the automatic recovery mechanism (optional but strongly recommended)

This is correctcrontabThe most strict test of the guard function. We will manually terminate the AnQiCMS process and then observecrontabWhether it can restart automatically within one minute

  1. First, useps aux | grep anqicmsFindanqicmsProcess ID (Process ID).
  2. Then, usekill -9 [PID]command to forcibly terminate the process.
  3. Wait for about a minute and then execute again.ps aux | grep anqicms. If everything is normal, you will find that the AnQiCMS process has reappeared andcheck.logthere will be an entry displayingexists -eq 0and then there will be an attempt to start the record.

If the program fails to restart automatically, you need to check it carefullystart.shThe logic, execution permissions, andcrontabconfiguration.

Final verification: directly access your AnQiCMS website

After all technical validations are completed, the most direct way to verify is to access your AnQiCMS website domain directly in the browser. If the website can load normally and function smoothly, that meansstart.shscripts andcrontabThey have successfully completed their guardianship mission.

By following these comprehensive verification steps, you will be able to understand AnQiCMS thoroughly and deeply.start.shScript incrontabThe status of the operation, ensure that your website has a stable and reliable automatic operation and fault recovery capability.


Frequently Asked Questions (FAQ)

1. Why mystart.shScript incrontabHas run (check.logThere are records), but the website still hasn't started?

This usually meanscrontabSuccessfully calledstart.shHoweverstart.shFailed to start the command for AnQiCMS internally. Possible reasons include:

  • Port conflict:

Related articles

On a Linux server, how can the AnQiCMS startup script `start.sh` ensure boot-up?

As an experienced website operations expert, I am well aware of the importance of a stable and reliable CMS system for a corporate website.AnQiCMS with its lightweight and efficient Go language features performs excellently in content management.However, even the most excellent system may become a major隐患 if it cannot automatically recover after the server restarts.Today, let's delve deeply into how to use the `start.sh` startup script that comes with AnQiCMS on a Linux server to ensure the system boots up automatically, keeping your website service online without any interruptions

2025-11-06

Why does AnQiCMS recommend using `crontab -e` to manage startup scripts?

Among many website management tools, AnQiCMS (AnQiCMS) has won the favor of many small and medium-sized enterprises and content operation teams with its efficient, stable, and easy-to-deploy features based on the Go language.However, when it comes to the continuous stable operation of the service, especially in the case of automatic recovery during server startup or unexpected situations, AnQiCMS provides a seemingly simple but ingeniously crafted solution: it is recommended to use `crontab -e` to manage its startup script.Why does AnQiCMS emphasize this method in particular

2025-11-06

What are the common errors when setting up the AnQiCMS scheduled task and clicking 'Save and Exit'?

As an experienced website operations expert, I am well aware of the importance of a stable and efficient content management system to the enterprise.AnQiCMS (AnQiCMS) is a lightweight, high-performance, and feature-rich solution that has become a powerful assistant for many small and medium-sized enterprises and content operation teams.Among them, the scheduling task function is a key link in the automation of operation, which allows content to be published on time, data to be automatically backed up, and other tasks to be carried out silently in the background, greatly improving the operation efficiency.

2025-11-06

How to correctly save and exit the configuration after `crontab -e` in AnQiCMS?

In the daily operation of website management, ensuring that all services of the system run continuously and stably is our core responsibility.For enterprise-level systems like AnQiCMS that are dedicated to providing efficient, customizable content management solutions, many core functions (such as time factor-scheduled publication, system self-maintenance, etc.) rely on the support of the Linux system's underlying scheduling task `crontab`.}When we need to configure or modify the scheduled tasks for AnQiCMS, we enter the editing interface by using the `crontab -e` command, and how do we correctly 'save and exit' the configuration at this time

2025-11-06

What are the specific steps to save and exit after `crontab -e` during AnQiCMS deployment?

As an experienced website operation expert, I am well aware that AnQiCMS, with its efficiency and advantages of Go language, is becoming the first choice of more and more enterprises and self-media users.In system deployment and daily operations, ensuring stable service operation is of paramount importance.While `crontab` is a powerful time task tool in the Linux system, it plays an indispensable role in the automated management of AnQiCMS.When we use command line tools, such as SSH to connect to the server and try to edit the scheduled tasks, we will use the command `crontab -e`

2025-11-06

What issues will the service encounter if the AnQiCMS `crontab` configuration is not saved correctly?

## AnQiCMS `crontab` configuration incorrect: Hidden time bomb and website operation crisis As an experienced website operation expert, I know that the stable operation of a high-performance content management system not only depends on its powerful core functions, but also on the support of many 'nameless heroes' behind the scenes.In an AnQiCMS system developed based on Go language, focusing on efficiency and scalability, `crontab` (the timing task service of the Linux system) is just such a key behind-the-scenes hero.It is not just simply executing scripts

2025-11-06

Besides `start.sh`, what services of AnQiCMS can be managed automatically through `crontab`?

As an experienced website operations expert, I know how much convenience a high-efficiency content management system (CMS) can bring to operations.AnQiCMS, with its efficient features of Go language and in-depth understanding of enterprise operations, indeed provides many practical functions in the field of automation management.We mention `start.sh`, which is usually used to ensure that the AnQiCMS core service runs continuously as a daemon script, and it is started at regular intervals through `crontab` to ensure the online stability of the website.This is just the tip of the iceberg, AnQiCMS has many other services

2025-11-06

AnQiCMS task scheduling configuration error, how to safely edit and 'Save and Exit'?

In the daily operation of the website, automated tasks play a crucial role.For a content management system like AnQiCMS that focuses on efficiency and flexibility, scheduled tasks are a powerful tool to enhance operational efficiency.They run silently in the background, performing a series of tasks such as scheduled content release, SEO data update, system maintenance, etc.However, when these plan tasks encounter configuration errors, they often bring considerable inconvenience to the normal operation of the website.Today, let's delve into the configuration error of the AnQiCMS scheduled task

2025-11-06