Updated on 2023-11-28 GMT+08:00

Other FAQs

Service Started Normally But Exits Abnormally Upon Application Deployment Completion

Symptoms

After a command or script for starting a service is deployed, the service is started. However, the service exits unexpectedly when application deployment is complete.

Cause Analysis

The possible cause is that the service is started in synchronous mode, which means that the child process will also end when the parent process ends. As a result, the session for starting the service is disconnected when application deployment is complete.

Solution

Run the following command to start the service in asynchronous mode:

nohup ${command} > ${log_file} 2>&1 & 

In the preceding command, ${command} indicates the service startup command, and ${log_file} indicates service startup logs. If you do not want to export log files, use /dev/null instead.

Application Deployment Is Complete, But the Service Fails to Be Stopped

Symptoms

The result shows that the command or script for stopping a service has been deployed successfully, but the service fails to be stopped.

Cause Analysis

The possible cause is that the service is stopped in asynchronous mode. In this case, an error may be reported, or a message indicating that the deployment is complete is displayed even though the deployment is actually not complete.

Solution

Deploy the command for stopping a service in synchronous mode. If an error is reported, rectify the fault as prompted.

Timeout Caused by Continuous Application Deployment

Symptoms

After the deployment of the action Run Shell Commands, application deployment continues and causes a timeout.

Cause Analysis

  • The deployment efficiency of commands in applications is low, so the deployment requires a long time.
  • Interactive commands are contained in the script, and these commands require user inputs on the client.

Solution

  • Manually run the commands in the application on the target host, and check whether the script deployment duration exceeds the timeout interval (30 minutes).
  • Check whether interactive commands, such as read, sudo, su, and yum, are contained. If there are no interactive commands, you can manually run the script on the target host.

Command That Exists on the Target Host Fails to Be Found During Application Deployment

Symptoms

A command exists on the target host, but during application deployment, a message indicating that the command does not exist is displayed.

Cause Analysis

The installation directory corresponding to the command is not added to the environment variable file /etc/profile.

Solution

  1. Log in to the target host and run the following command to view the command installation directory:
    type ${command} 
  2. Modify the application. Specifically, use the absolute path to call the corresponding command, or add the command installation directory to the environment variable file /etc/profile of the target host.

Shell Script Deployment Is Complete, But Expected Result Is Not Achieved

Symptoms

Deployment of the shell script is complete, but it does not achieve the expected result.

Cause Analysis

The script fails to be executed.

Solution

During the deployment of the shell script, the script execution result is displayed. You can use the following two execution options provided by the shell script to facilitate fault locating:

  • set –e option: The script execution exits upon the first command execution failure, and an error message is returned.
  • set –x option: Debug information is generated for the execution of each command during script execution.

Running Shell Commands FAQs

more