Running Shell Commands
This action aims to run shell scripts on a host in a specified environment. The following table shows the configuration.
Parameter |
Description |
---|---|
Action Name |
Name of an added deployment action. Max 128 characters. Do not start or end with a space. Use letters, digits, spaces, and these special characters: -_,;:./(). |
Environment |
Select a host cluster as the deployment object. |
Shell Commands |
Bash scripts to run. |
Control Options |
|
Example: Using Shell Commands to View Service Logs
After application deployment is complete, you can run the shell commands to view the service startup or execution logs.
Preparations
- Ensure that you are an authorized user of a host. Only authorized users have the permissions required to view service startup or execution logs.
- Determine the full path of the service startup log.
The following describes how to install the Tomcat service:
Full path of the service startup log: /usr/local/tomcat/apache-tomcat-8.5.38/logs/catalina.out
Procedure
- Run the tail command to query the service startup or execution logs.
- Run the following command to query the last 20 lines of the log. The following figure shows the command output.
tail -n 20 /usr/local/tomcat/apache-tomcat-8.5.38/logs/catalina.out
Do not run the cat command when running the shell command to view files. If the log file is too large, it may take some time to load data. Do not use the tail –f command.
If the shell command to be executed contains more than 10,240 characters, you are advised to Run Shell Script extension.
If you encounter any problem during deployment, see Solutions to Common Problems.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot