How to adjust the `start.sh` script after changing the executable file name of AnQiCMS in order to continue working?

Calendar 👁️ 64

As an experienced security CMS website operator, I am well aware of the importance of maintaining the stable operation of the website, especially when adjusting the core system files.AnQiCMS with its efficiency and lightweight nature in the Go language is widely popular in actual operation.However, any modification to the core components requires meticulous adjustments to ensure the normal operation of the system.Among other things, after changing the executable file name of AnQiCMS, the corresponding startup scriptstart.shIt must also be adapted for compatibility.


Understand the AnQiCMS startup scriptstart.shthe core role

The deployment of AnQiCMS, especially under Linux, usually depends on a name calledstart.shA script to manage the startup and monitoring of the application. The main responsibility of this script is to check if AnQiCMS is running, and if it is not, it will automatically start the application.This mechanism ensures that AnQiCMS can automatically restore services even after unexpected crashes or server restarts, greatly enhancing the availability and stability of the website.

start.shThe script contains several key variables and commands that work together to identify and execute the AnQiCMS main program. Among them,BINNAMEVariables are used to specify the name of the executable file, andps -ef | grepThe command is used to find the process corresponding to the name in the system process list.If these names do not match the actual executable files running, the script will not be able to detect and start AnQiCMS correctly.

Adjust the script after changing the executable file name of AnQiCMS

When you decide to change the executable file name of AnQiCMS for some reasons (such as improving security, avoiding conflicts with other programs in the system, or distinguishing between multiple different instances running on the same server),start.shThe related references in the script must also be updated synchronously. Otherwise, even if the executable file itself exists and can be manually run, the auto-start script will not be able to find it, causing AnQiCMS to fail to start automatically or restart when needed.

Adjuststart.shThe script needs to be modified to accommodate the new executable filename, you need to modify two key positions in the script.

First, you need to find the script.BINNAMEVariable definition line. It is usually set to in the original scriptBINNAME=anqicms. You need toanqicmsReplace it with your new executable filename. For example, if your new executable filename ismyanqicms_webThis line should be modified toBINNAME=myanqicms_web.

Next, the script is used to pass throughgrepThe command line to find the running process also needs to be modified. This line of code usually containsgrep '\<anqicms\>'. Here,anqicmsThe same needs to be replaced with your new executable filename. Please make sure to keep it\<and\>These special characters are ingrepThe command represents a 'word boundary', ensuring that only complete filenames are matched, rather than strings containing the name, to avoid affecting unrelated processes. For example, if your new filename ismyanqicms_webIt should be modified asexists=\ps -ef | grep '<myanqicms_web>' |grep -v grep |wc -l

It is worth noting that the commands actually executed by AnQiCMS in the script usually refer to$BINNAMEFor example,nohup $BINPATH/$BINNAME >> $BINPATH/running.log 2>&1 &. Since you have updatedBINNAMEVariable definition, this line of code will automatically use the new executable filename without any additional modification.

Detailed operation steps

To complete these modifications, please follow the following steps:

First, connect to your AnQiCMS server using SSH.

Next, navigate to the AnQiCMS installation directory, usually/www/wwwroot/anqicmsOr specify a custom path. Find it in the directory.start.shthe script file.

Then, open the file with your preferred text editor (such as)viornano).start.shRun the file. For example,nano start.sh.

In the opened file, locate toBINNAMEthe line of the variable definition, change its value fromanqicmsto your new executable filename.

Next, find the line containinggrep '\<anqicms\>'and change it toanqicmsReplace with your new executable filename and make sure to keep it\<and\>.

Save the file and exit the editor after making the changes

To ensurestop.shThe script also works correctly, performing the same modification steps. Instop.shIn, you also need to changeBINNAMEvariables as well asgrepThe name of the executable file referenced in the command. Keep the two scriptsBINNAMEConsistency is the key to ensuring that AnQiCMS can be started and stopped correctly.

Finally, execute./start.shManually test the new script using the command and check if AnQiCMS can start normally. You can useps -ef | grep your_new_executable_nameCommand to verify that the new executable file is running. Also, checkrunning.logandcheck.logthe file, confirm that there are no error messages.

By making the above adjustments, changing the executable file name of AnQiCMS will not affect its automatic startup and management functions, ensuring the smooth operation of the website.


Frequently Asked Questions

If I change the executable file name but forget to modifystart.shWhat will happen to the script?

If the executable file name of AnQiCMS is changed without updating accordinglystart.shScript, the system will not be able to start AnQiCMS automatically through this script.This means that after the server restarts, or the AnQiCMS process is unexpectedly terminated, your website will not be able to automatically restore services.You need to manually locate the new executable file and run it, or manually edit and updatestart.shTry to start the script again. In the long run, this will affect the stability and availability of the website, increasing the burden of operation and maintenance.

Why do we need to change the name of the AnQiCMS executable file?

There are various practical application scenarios for changing the name of an executable file.When deploying multiple AnQiCMS instances on the same server, assigning different executable filenames to each instance helps distinguish and manage them, preventing process conflicts.Secondly, from a security perspective, changing the default filename to an uncommon or customized name can slightly increase the In addition, custom executable filenames may also be convenient for certain specific operational processes or tool integrations.

modifystart.shWill the script affect the database connection or configuration of AnQiCMS?

No. Modify.start.shThe script is simply to allow the system to correctly identify and start the binary file of AnQiCMS application.This operation is purely for the application startup logic and will not affect the internal configuration of AnQiCMS (such as database connection, port settings, website address, etc.).These configuration information is usually stored inconfig.jsonIn other configuration files, it is irrelevant to the name of the executable file. You just need to make sure that the executable file can read these configuration files correctly.

Related articles

What impact does the `BINNAME` variable have on process identification in the `start.sh` script?

HelloAs an experienced CMS website operation personnel, I fully understand how important it is to have a clear grasp of the underlying mechanisms when managing the system.`start.sh` script's `BINNAME` variable seems simple, but it plays a core role in the process identification and stable operation of the security CMS.Below, I will elaborate on the impact of this variable on process identification.

2025-11-06

How does the mechanism of detecting PID with `grep '\u003canqicms>'` in `start.sh` work?

As an experienced CMS website operation personnel, I know that the stable operation of the website is the basis for the effective dissemination of content.In daily work, we must not only pay attention to the quality of the content and the user experience, but also ensure the continuous and reliable operation of the backend services.AnQi CMS provides a simple and efficient mechanism for this, using specific commands in the `start.sh` script to detect and maintain the running status of the core application.The `start.sh` script plays the role of a guardian in the deployment of AnQi CMS.Its main responsibility is to check if the main program is running

2025-11-06

If the AnQiCMS process is unexpectedly closed, how long will the `start.sh` script attempt to restart it?

As an experienced CMS website operation person in the security industry, I fully understand the importance of system stability for business continuity.AnQiCMS is a high-efficiency content management system, the stable operation of which is one of the key points of our daily maintenance.When the AnQiCMS main process is closed due to an abnormal condition, the system is designed to ensure that the service can recover quickly through automated scripts.

2025-11-06

How does the `start.sh` script implement the automatic restart of the AnQiCMS process after an unexpected termination?

As a website manager who deeply understands the operation of AnQiCMS, I know that the stable operation of the system is important for content publishing and user experience.In daily operations, even well-designed systems may encounter unexpected situations that can cause core process interruption.AnQiCMS through its cleverly designed `start.sh` script effectively solved this problem, ensuring the continuous availability of the service.The `start.sh` script is responsible for continuously monitoring the AnQiCMS main process running status

2025-11-06

How to avoid PID conflicts between different instances when deploying AnQiCMS across multiple sites?

As an experienced security CMS operation personnel, I am well aware that the stability and efficiency of the system are crucial when managing multiple websites.The AnQi CMS provides strong support for us with its high concurrency characteristics of the Go language and multi-site management features.However, when deploying multiple security CMS instances on the same server, how to properly handle process ID (PID) conflicts to ensure that each instance runs independently and stably is a core issue that needs to be addressed in operations.

2025-11-06

How to configure independent `start.sh` and `stop.sh` scripts for each AnQiCMS multi-site instance?

As an expert deeply familiar with AnQiCMS (AnQiCMS) operation, I understand that you want to implement independent management for each AnQiCMS site instance. In multi-site operations, although AnQiCMS provides powerful built-in multi-site management features, sometimes in order to achieve finer-grained resource isolation, independent process management, or personalized optimization for specific sites, we may need to run each site on an independent AnQiCMS application instance.

2025-11-06

What is the specific function and advantage of the `nohup` command in the AnQiCMS startup script?

In the daily operation of AnQiCMS, system stability and reliability are the core.As a high-performance content management system built with Go language, AnQiCMS needs to ensure that its core services can run continuously and without interruption.In the Linux server environment, the `nohup` command plays a crucial role in the startup script of AnQiCMS, ensuring this and providing many conveniences.

2025-11-06

Which AnQiCMS process information are recorded in the `running.log` and `check.log` files, and how can they be used for troubleshooting?

As an experienced CMS website operation personnel, I am well aware of the importance of website stability for content publication and user experience.In daily work, log files are an indispensable tool for diagnosing system health and quickly locating problems.AnQi CMS provides the `running.log` and `check.log` log files, which record different process information and together provide valuable clues for troubleshooting system failures.

2025-11-06