As an experienced website operations expert, I am well aware that it is crucial to have flexible control over the start and stop of applications when managing website services.AnQiCMS (AnQiCMS) is an efficient content management system based on the Go language, which took into account the ease of deployment and service stability from the beginning. Therefore, it is usually configured to start automatically after the server restarts to ensure the continuity of website services.This kind of automated startup is usually achieved through system-level scheduled tasks (such as Cron jobs under Linux or the restart strategy of Docker containers).
However, in certain specific scenarios, we may need to prevent AnQiCMS from automatically starting after the server restarts.For example, you may be performing important system maintenance, database migration, version upgrade testing, or simply wish to manually control the start and stop of services during a specific time period.In this case, it is particularly important to understand how to gracefully stop its automatic startup mechanism and ensure that it does not run automatically after restart.
Next, I will focus on 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 be explained in detail for you.
Understand the automatic startup mechanism of AnQiCMS
The automatic startup of AnQiCMS is essentially to execute the AnQiCMS executable file (usuallyanqicmsoranqicms.exeConfigure to the startup items or scheduled tasks of the operating system. The implementation method varies slightly depending on the deployment environment:
- Traditional Linux/macOS server deployment:In most cases, it will pass
crontabCommand to add a periodic execution script (such asstart.shThis script checks if AnQiCMS is running, and if not, starts it.In addition, some users may also use service management tools like Systemd, Supervisor to manage processes. - Windows server/local development environment deployment:Under Windows environment, if automatic startup is configured, it is usually through the creation of a scheduled task via the 'Task Scheduler', or through the 'Boot Start' option provided by tools such as Baota panel, Xiaopi panel, and others.
- 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 include
alwaysAlways restart,unless-stoppedRestart continuously unless manually stopped, etc.
Having clarified these startup mechanisms, we can carry out stopping operations specifically.
Detailed steps to stop AnQiCMS from automatically starting after server reboot
Please select the corresponding method to operate according to your AnQiCMS deployment environment:
For Linux/macOS servers (via Cron or script daemon)
If your AnQiCMS is throughcrontab -eThe scheduled task added by command will automatically start, then you need to edit or remove this Cron job.
View and edit the Cron job:Open a terminal or SSH client and enter the following command to edit the current user's Cron job:
crontab -eThis will open a text editor and display all the Cron jobs for your current user.
Locate and remove/comment the relevant tasks:In the open file, look for lines related to AnQiCMS startup, which usually contain
anqicms/start.shsuch keywords, the format may be similar to:*/1 * * * * /www/wwwroot/your_anqicms_path/start.shTo 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 one in front of the line.
#Comment out the number. For example:
Comments are the recommended approach, as they allow you to easily restore the automatic startup in the future without having to re-enter the entire command.# */1 * * * * /www/wwwroot/your_anqicms_path/start.sh
Save and exit:In the text editor (usually vi/vim), press
Esckey, then enter:wqand press Enter to save changes and exit. Or if you are using the nano editor, pressCtrl+XThen pressYConfirm save and finally pressEnter.Stop the currently running AnQiCMS instance (if it exists):Only removed the Cron task, and it cannot stop the currently running AnQiCMS instance.You need to manually stop it before restarting the server. If the AnQiCMS installation directory provides
stop.shScript, you can run it directly:/www/wwwroot/your_anqicms_path/stop.shIf
stop.shNot available, you can find and kill the AnQiCMS process:ps -ef | grep '\<anqicms\>' | grep -v grepFind the PID (Process ID) of the AnQiCMS process and then use
kill -9 {PID}the command to forcibly terminate it.After completing the above operation, even if the server restarts, AnQiCMS will no longer automatically start through Cron jobs.
For Windows server/local development environment (through Task Scheduler or panel settings)
Under Windows environment, the automatic startup of Anqi CMS is usually controlled by the "Task Scheduler".If you use panel tools such as Baota Panel, Xiaopi Panel, etc., they will provide a more intuitive interface for settings.
Disable through Task Scheduler:
- Open 'Task Scheduler': Enter 'Task Scheduler' in the Windows search bar and open it.
- Navigate to the task: Browse the left tree structure in the task schedule program library to find tasks related to AnQiCMS. The names of these tasks may contain “AnQiCMS”, “anqicms”, or point to
start.sh/anqicms.exeThe path. - Disable or delete the task: After finding the task, right-click on it and select 'Disable' or 'Delete'. Disabling will keep the task but prevent it from running, while deleting will remove it completely.
Disable through panel tools (such as Baota Windows panel, Small Skin panel):
- Log in to your panel tool.
- Find the menus related to "website", "project", "startup", or "scheduled task" and so on.
- Locate the AnQiCMS project or related startup items and uncheck their 'Startup' or 'Scheduled Task' options.
Stop the currently running AnQiCMS instance:On Windows, you can stop the AnQiCMS process through the Task Manager.
- Press
Ctrl+Shift+EscOpen Task Manager. - Switch to the "Details" tab.
- Find the process named in the process list.
anqicms.exeprocess. - Right-click the process and select "End Task".
After these steps, AnQiCMS will not run automatically after the Windows server restarts.
- Press
Third, for Docker container deployment (modify Docker restart strategy)
If you deploy 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.
Log in to your Docker management interface:Whether it's 1Panel, aaPanel, or Baota panel, there is a dedicated container management interface. Log in and enter the interface.
Locate the AnQiCMS container:Find the AnQiCMS container you have deployed in the container list, usually its name will be
anqicmsor a custom name you have set.Modify the container's restart policy:
- Click the “Details” or “Edit” button of the AnQiCMS container.
- In the container configuration options, find the 'Restart Policy' or similar settings.
- Change it to
no(Do not restart) oron-failure(Restart only when the container exits abnormally, but not when manually stopped). It may be by defaultalwaysorunless-stopped. Set it tonocompletely prevent automatic startup.
Stop the AnQiCMS container currently running:After modifying the restart policy, you need to stop and restart the container to make the new policy 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 no longer 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 regardless of the method you use to stop the automatic startup of AnQiCMS:
- Manually stop the current instance:Ensure that the currently running AnQiCMS instance has been stopped.
- Simulate server restart:Perform a server restart operation during a non-production environment or maintenance window.
- Check AnQiCMS status:After the server restart, by accessing the website URL (should not be accessible), or using
ps -ef | grep anqicms(Linux/macOS)/Task Manager (Windows)/Docker Container List (Docker) to verify that AnQiCMS does not automatically start.
Be cautious when performing these operations. Stopping AnQiCMS means your website will be inaccessible, so please ensure it is done during an appropriate maintenance window and notify your users in advance.
Frequently Asked Questions (FAQ)
1. Where should I disable the startup of AnQiCMS when using Baota panel on Windows?
In the Baota Windows panel, AnQiCMS boot-up starts automatically