How to check if the `stop.sh` script of AnQiCMS has sufficient execution permissions?

Calendar 👁️ 66

As an experienced website operations expert, I know that a stable-running website cannot do without proper management of the background scripts.AnQiCMS with its efficient and secure features is deeply loved by our operations staff.In routine maintenance, whether it is for version upgrades, configuration adjustments, or simple restart operations, we may need to use the system's built-instop.shandstart.shScript. However, a seemingly simple operation may be受阻 due to a minor permission issue. Today, let's delve into how to ensure the stability of AnQiCMS'sstop.shThe script has sufficient execution permissions to make your maintenance work smoother.

Understandingstop.shThe importance of the script

In the AnQiCMS running environment,stop.shThe script plays a crucial role. It is usually responsible for safely terminating the background process of AnQiCMS.Imagine when we need to update the system, adjust the configuration, or simply restart the service, ifstop.shUnable to execute normally, may cause the service to stop abnormally, affecting subsequent operations, or may cause data inconsistency or service exceptions.The essence of this script is a set of shell commands, which will find the PID (Process Identifier) of the AnQiCMS process and then send a signal to terminate it.Therefore, ensuring that it can be "executed" and "has the right to execute" the corresponding system operations is the foundation for the stable operation of the website.

Why do permission issues occur?

In Linux systems, file permissions are very strict, which is for system security reasons.Each file and directory has its owner, group, and read (r), write (w), and execute (x) permissions for the owner, group, and other users.A shell script, if it is not marked as 'executable', then the system does not know how to run it.It's like you've got a manual, but it's locked in a box and you can't open it to read.

Generally, when we manually upload files or during certain automated deployment processes,stop.shscripts may lose execution permissions due to incorrect permission settings. For example, file permissions may be-rw-r--r--This means that the owner has read and write permissions but no execution permissions, while other users can only read.

How to checkstop.shexecution permissions?

Checkstop.shThe execution permission of the script is not complicated, we need to connect to the Linux server where your AnQiCMS is located via the SSH client.

First, you need to locate the installation directory of AnQiCMS. According to the deployment guidelines of AnQiCMS, this directory is usually located in/www/wwwroot/anqicmsor a similar path. You can usecdCommand to enter the directory:

cd /www/wwwroot/anqicms # 替换为你的实际安装路径

After entering the directory, usels -lCommand to viewstop.shThe detailed permission information of the file:

ls -l stop.sh

You will see a line output similar to the following:

-rw-r--r-- 1 www www 500 Jun 7 10:30 stop.sh

Or:

-rwxr-xr-x 1 www www 500 Jun 7 10:30 stop.sh

We need to focus on the first 10 characters on the left.

  • the first character.ordIndicates the file type (-Indicates a regular file,dIndicates a directory).
  • The next 9 characters are divided into three groups, representing the permissions of the file owner (owner), the file group (group), and other users (others):
    • rwxIndicates read, write, and execute permissions.
    • rw-Indicates read and write permissions, no execute permission.
    • r-xIndicates read and execute permissions, no write permission.

Ifstop.shPermissions displayed as-rw-r--r--This means that the owner and other users do not have execution permissions (x), then when you try to run./stop.shWhen, the system will prompt “Permission denied” (insufficient permissions).

How to grantstop.shexecution permissions?

Granting script execution permission is very direct. In the Linux system, we usechmodcommands to modify file permissions.

The simplest and most common method is to usechmod +xThe command, it adds execute permission for the owner, group, and other users:

chmod +x stop.sh

After executing this command, you can use it againls -l stop.shConfirm that the permissions have been changed to-rwxr-xr-x.

If you want to control permissions more finely, or ensure that it has secure universal permissions, you can use the numeric pattern:

chmod 755 stop.sh

Here755Means:

  • 7(rwx): The file owner has read, write, and execute permissions.
  • 5(r-x): The group owning the file has read and execute permissions.
  • 5(r-x): Other users have read and execute permissions.

This755The permission setting is usually the recommended practice for shell scripts, as it allows the owner of the script to have complete control over the script while allowing other users to run but not modify the script.

when executingchmodWhen issuing commands, if the currently logged-in user is not the file owner or does not have sufficient permissions, the system may prompt insufficient permissions. At this time, you need to add before the commandsudoExecute with superuser privileges:

sudo chmod +x stop.sh

Or

sudo chmod 755 stop.sh

Verify and test the script

After modifying the permissions, be sure to verify and test.

  1. Confirm the permissions again:Runls -l stop.shTo ensure that the permissions are displayed as-rwxr-xr-x.
  2. Start AnQiCMS:Ensure AnQiCMS is running. You can check if there is a running process for AnQiCMS by executingps -ef | grep anqicms.
  3. Attempt to stop the service:Now, try to runstop.shScript:
    
    ./stop.sh
    
    If your current user is notstop.shthe owner, oranqicmsthe process is run by another user (such aswwwUser initiated, to ensurestop.shYou have permission to terminate the process, you may need to usesudoTo run:
    
    sudo ./stop.sh
    
  4. Verify the stop result:Run againps -ef | grep anqicmsIf the AnQiCMS process does not display or only remainsgrepthe command itself, then congratulations to you,stop.shthe script has been executed successfully.

By this series of steps, you have not only solvedstop.shThe issue of execution permissions also deepened my understanding of Linux file permission management. This is a very practical skill for any website operator.


Frequently Asked Questions (FAQ)

Q1:chmod +xandchmod 755What is the difference? Which one should I use?

chmod +x stop.shThe command will add (+) execution (x) permissions for the file owner, group, and other users, but will not change other permissions (read/write). While `chmod 7

Related articles

Does stopping the AnQiCMS service affect the access to the back-end management interface?

Hello, as a senior website operations expert, I know that every technical detail may affect the stability and management efficiency of the website.Today, we will delve deeply into a core issue about AnQiCMS service: Will stopping the AnQiCMS service affect the access to the back-end management interface?The answer is affirmative: **Stopping the AnQiCMS service will directly result in the inability to access your website's front-end and back-end management interfaces.

2025-11-06

What are the steps to stop the AnQiCMS container in 1Panel or aaPanel?

Certainly, as an experienced website operation expert, I am happy to provide a detailed explanation of the steps to properly stop the AnQiCMS container operation in popular server management panels like 1Panel or aaPanel. --- ## Graceful shutdown: Practical guide to stopping AnQiCMS container in 1Panel or aaPanel In daily website operation, we often need to maintain, upgrade, or troubleshoot services.

2025-11-06

Does the Docker deployed AnQiCMS container lose its data after stopping?

## Docker deployment of AnQiCMS, will the data really be lost after stopping?—Website Operation Expert Deeply Deciphers for You Hello everyone, I am your veteran website operation elder.In the digital wave, an efficient content management system (CMS) is the cornerstone of website operation, and Docker, with its lightweight and portable features, is gradually becoming the preferred solution for deploying various applications.AnQiCMS as an enterprise-level content management system developed based on the Go programming language, has won the favor of many users with its efficient and customizable features.

2025-11-06

What template page will the user see after AnQiCMS's 'Website Status' is set to 'Offline'?

As an experienced website operations expert, I am well aware that how to properly handle user access experience is crucial during the website maintenance process.AnQiCMS (AnQiCMS) is an efficient and feature-rich enterprise-level content management system that also provides an intuitive and flexible solution in this aspect.Today, let's delve deeper into the template page that users will see after setting the 'Website Status' to 'Closed Station' in the AnQi CMS backend.

2025-11-06

How can AnQiCMS be stopped and restarted correctly after changing the configuration (such as the port)?

As an experienced website operations expert, I am happy to elaborate on how to properly shut down and restart AnQiCMS after configuration changes (especially port changes).This is not only the key link in daily maintenance, but also the foundation to ensure the stable and efficient operation of the website.

2025-11-06

Is there a special consideration for stopping the AnQiCMS project when the server memory is insufficient?

As an experienced website operations expert, I fully understand the importance of server resource health status for the stable operation of the website.When the server's memory indicator light turns red, it often means that the system is at the edge of sub-health or even danger.For a content management system like AnQiCMS, choosing to stop the project in such an emergency situation indeed involves some special considerations that are worth in-depth discussion.

2025-11-06

How to back up data for AnQiCMS project before stopping or deleting it to prevent any unexpected situations?

## The Completion of a Task, Data as the Foundation: Data Backup Strategy Before the Suspension or Deletion of the AnQiCMS Project As an experienced website operations expert, I am well aware that every content management system carries not only text and images but also the digital assets of corporate brand image, marketing wisdom, and even core business logic. For a familiar enterprise-level content management system like AnQiCMS, which is known for its efficiency, security, and customization based on the Go language, the value of the data it manages is self-evident

2025-11-06

How to identify the PID of AnQiCMS process to manually stop or monitor?

As an expert who has been deeply engaged in website operation for many years, I am well aware that AnQiCMS, with its genetic code of Go language, performs excellently in terms of performance and security.However, even the most stable systems are bound to encounter scenarios that require manual intervention, whether it be for troubleshooting, resource optimization, or dealing with emergencies.At this time, accurately identifying and managing the PID (Process ID, process identifier) of the running AnQiCMS process is particularly crucial.Mastering this skill will enable you to handle complex problems with ease.

2025-11-06