As a senior website operations expert, I know that it is crucial to flexibly control the start and stop of the application when managing website services.AnQiCMS (AnQiCMS) is an efficient content management system based on the Go language, which takes into account the ease of deployment and service stability from the beginning of its design. Therefore, it is usually configured to start automatically after the server restarts to ensure the continuity of the website service.This automated startup is usually implemented through system-level scheduled tasks (such as Cron jobs under Linux or the restart policy of Docker containers).

However, in certain specific scenarios, we may need to prevent AnQiCMS from automatically starting after the server restart.For example, you may be performing important system maintenance, database migration, version upgrade testing, or simply want to manually control the start and stop of services during a specific time period.In this case, understanding how to gracefully stop its automatic startup mechanism and ensure that it does not run automatically after restart is particularly important.

Next, I will discuss how to ensure that AnQiCMS does not automatically start (stop the scheduled task) after the server restarts?This topic, combined with the common deployment methods of AnQiCMS, will provide you with a detailed explanation of the operation steps.

Understand the automatic startup mechanism of AnQiCMS

The automatic startup of AnQiCMS, in essence, is to execute the AnQiCMS executable file (usually}]}anqicmsoranqicms.exeConfigure to the startup item or scheduled task of the operating system. The implementation method varies slightly depending on the deployment environment:

  1. Traditional Linux/macOS server deployment:Most of the time, it will becrontabadded by command to run a periodic script (such asstart.shThe script checks if AnQiCMS is running, and if not, starts it.In addition, some users may also use service management tools such as Systemd, Supervisor to monitor processes.
  2. Windows server/local development environment deployment:Under Windows environment, if automatic startup is configured, it is usually done by creating a scheduled task through 'Task Scheduler' or by using the 'Boot Startup' option provided by tools such as Baota panel, Xiaopi panel, etc.
  3. Docker container deployment:When AnQiCMS is deployed in a Docker container, its automatic startup behavior is controlled by the Docker container's "restart policy". Common strategies includealways(Always restarts),unless-stopped(Continues to restart unless manually stopped) etc.

Once these startup mechanisms are clarified, we can carry out stop operations targetedly.

Stop AnQiCMS from automatically starting after server restart in detail

According to the environment where you deploy AnQiCMS, please choose the corresponding method to operate:

一、针对Linux/macOS服务器(通过Cron或脚本守护)

如果您的AnQiCMS是通过Englishcrontab -eThe scheduled task to be added is set to automatic, so you need to edit or remove this Cron job.

  1. View and edit the Cron job:Open the terminal or SSH client, enter the following command to edit the current user's Cron job:

    crontab -e
    

    This will open a text editor displaying all of your current user's Cron jobs.

  2. Locate and remove/comment related tasks:In the opened file, search for lines related to AnQiCMS startup, which usually containsanqicms/start.shkeywords, which may be formatted like:

    */1 * * * * /www/wwwroot/your_anqicms_path/start.sh
    

    To prevent it from automatically starting, you can choose one of the following methods:

    • Completely delete:Directly delete the entire line containing the above content.

    • Comment out:Add a number before the line:#to comment it out. For example:

      # */1 * * * * /www/wwwroot/your_anqicms_path/start.sh
      

      Comments are the recommended approach, as they allow you to easily restore automatic startup in the future without having to re-enter the entire command.

  3. Save and exit:In the text editor (usually vi/vim), pressEsckey, then enter:wqand press Enter to save changes and exit. Or if you are using the nano editor, then pressCtrl+XThen pressYConfirm save, finally pressEnter.

  4. Stop the currently running AnQiCMS instance (if it exists):Just removed the Cron job, but it cannot stop the current running AnQiCMS instance.You need to manually stop it before the server restarts.stop.shScript, you can run it directly:

    /www/wwwroot/your_anqicms_path/stop.sh
    

    Ifstop.shNot available, you can find and kill the AnQiCMS process:

    ps -ef | grep '\<anqicms\>' | grep -v grep
    

    Find the PID (Process ID) of the AnQiCMS process, then usekill -9 {PID}command to force it to terminate.

    After completing the above operation, even if the server restarts, AnQiCMS will no longer be automatically started by the Cron job.

English, for Windows server/local development environment (through Task Scheduler or panel settings)

Under Windows environment, the automatic startup of AQ CMS is usually controlled by the 'Task Scheduler'.If you use tools like Baota Panel, Small Skin Panel, etc., they will provide a more intuitive interface for settings.

  1. Disable through Task Scheduler:

    • Open the "Task Scheduler": Type "Task Scheduler" in the Windows search bar and open it.
    • Navigate to task: Browse the tree structure on the left side of the task plan program library to find tasks related to AnQiCMS. The names of these tasks may contain “AnQiCMS”, “anqicms”, or point tostart.sh/anqicms.exeThe path.
    • Disable or delete a task: After finding the task, right-click it and select "Disable" or "Delete". Disabling will keep the task but prevent it from running, while deleting will remove it permanently.
  2. Disable through the panel tool (such as Baota Windows panel, XiaoPi panel).

    • Log in to your panel tool.
    • Search for related menus such as "Website
    • Locate the AnQiCMS project or related startup items, and uncheck the 'Boot startup' or 'Scheduled task' option.
  3. Stop the currently running AnQiCMS instance:On Windows, you can stop the AnQiCMS process by using Task Manager.

    • pressCtrl+Shift+EscOpen Task Manager.
    • Switch to the “Details” tab.
    • In the process list, find the process namedanqicms.exeexists in the system.
    • Right-click the process and select “End Task”.

    After these steps, AnQiCMS will not run automatically after the Windows server restarts.

三、针对Docker容器化部署(修改Docker重启策略)

If you have deployed AnQiCMS through Docker, such as using 1Panel, aaPanel, or Baota Docker plugin, etc., then the automatic startup of AnQiCMS is controlled by the container's restart policy.

  1. Login to your Docker management interface:)Whether it is 1Panel, aaPanel, or Baota panel, there is a dedicated container management interface. Log in and enter the interface.

  2. Locate the AnQiCMS container:Find the AnQiCMS container you deployed in the container list, usually its name will beanqicmsor a name you customized.

  3. Modify the container's restart policy:

    • Click the 'Details' or 'Edit' button for the AnQiCMS container.
    • In the container configuration options, find "Restart Policy" or similar settings.
    • Change it tono(Do not restart) oron-failureIt restarts only when the container exits abnormally, but not when manually stopped. By default, it may bealwaysorunless-stopped. Set it tonocan completely prevent automatic startup.
  4. Stop the currently running AnQiCMS container:After modifying the restart policy, you need to stop and restart the container for the new policy to take effect.In the container management interface, select the AnQiCMS container and then click the "Stop" button.After that, you can choose to manually 'start' it, but it will not start automatically after the server restarts.

    # 如果您直接使用Docker命令行,可以这样操作:
    docker update --restart=no your_anqicms_container_name
    docker stop your_anqicms_container_name
    

Verify and **Practice

It is strongly recommended to perform the following verification whether you stop the automatic startup of AnQiCMS in any way:

  • Manually stop the current instance:Ensure that the currently running AnQiCMS instance has stopped.
  • Simulate server restart:Perform a server restart operation once in a non-production environment or during maintenance window.
  • Check AnQiCMS status:After the server restarts, access the website URL (should not be accessible), or useps -ef | grep anqicms(Linux/macOS)/Task Manager (Windows)/Docker Container List (Docker) to verify whether AnQiCMS indeed does not start automatically.

Please be careful when performing these operations.Stopping AnQiCMS means that your website will be inaccessible, so please ensure it is done during an appropriate maintenance window and notify your users in advance.

Common Questions (FAQ)

1. I am using Baota Panel on Windows, where should I disable AnQiCMS from booting up automatically?

In the Baota Windows panel, AnQiCMS startup at boot