Help Center/
Cloud Server Backup Service/
Best Practices/
Using a Custom Script to Implement Consistent Backup for Other Linux Applications/
Compiling an Unfreezing Script
Updated on 2022-02-22 GMT+08:00
Compiling an Unfreezing Script
Example unfreezing script named appexample_unfreeze.sh:
#!/bin/sh AGENT_ROOT_PATH=$1 #The root directory required when the Agent invokes the script. Functions, such as log functions, will use this variable. Do not rename this directory. PID=$2 #The PID required when the Agent invokes the script. It is used for command output and do not rename it. . "${AGENT_ROOT_PATH}/bin/agent_func.sh"#Reference script framework, which provides functions, such as logging, encryption, and decryption #Result processing function, which writes operation results into given files for invokers to obtain return values. # Input parameter. $1: 0 indicates a success; 1 indicates a failure. # No return value #RESULT_FILE is defined in agent_func.sh. function ExitWithResult() { Log "[INFO]:Freeze result is $1." echo $1 > ${RESULT_FILE} chmod 666 ${RESULT_FILE} exit $1 } function Main() { Log "*********************************************************************" Log "[INFO]:Begin to freeze appexample." #Check whether appexample exists. If not, 0 is returned and the script exits. #In the process of unfreezing I/Os, the Agent program invokes each unfreezing script in sequence. If any script fails to be invoked, the whole process fails. To avoid interference from other programs, 0 should be returned when appexample cannot be found. which appexample if [ $? -ne 0 ] then Log "[INFO]:appexample is not installed." ExitWithResult 0 fi #Invoke the actual unfreezing command. appexample -unfreeze if [ $? -ne 0 ] then Log "[INFO]:appexample freeze failed." #Unfreezing failed. Record the result and exit. ExitWithResult 1 fi Log "[INFO]:Freeze appexample. success" #Unfreezing successful. Record the result and exit. ExitWithResult 0 } Main
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.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot