X7ROOT File Manager
Current Path:
/var/VMOptimizationToolsLinux
var
/
VMOptimizationToolsLinux
/
📁
..
📄
LinuxUpdate.XML
(645 B)
📄
SangforVMSTool
(3.11 KB)
📄
SangforVMSTool.service
(194 B)
📄
action_common.sh
(13.34 KB)
📄
busybox_cmd_ln.sh
(2.24 KB)
📄
collect_test_data.sh
(1.16 KB)
📄
common_config.sh
(278 B)
📄
data_test_tool.sh
(12.59 KB)
📄
debian_vmconfig.sh
(10.74 KB)
📄
guest_system_config.sh
(1.82 KB)
📄
log.sh
(1.36 KB)
📄
mod_test.sh
(3.69 KB)
📄
mod_test1.sh
(914 B)
📄
net_common.sh
(915 B)
📄
redhat_vmconfig.sh
(11.14 KB)
📄
sangfor_guest_datareport
(21.66 KB)
📄
sangfor_heartalive.sh
(2.37 KB)
📄
sangfor_module_update
(28.11 KB)
📄
sangfor_set_network.sh
(504 B)
📄
sangfor_sfping
(3.85 KB)
📄
sangfor_sshkey_gen
(1.29 KB)
📄
sangfor_update_ipc_callback
(5.29 KB)
📄
sangfor_vm_proxyd
(3.45 KB)
📄
sangfor_vm_proxyd_r
(4.4 KB)
📄
sangfor_vm_proxyd_w
(1.32 KB)
📄
sangfor_vmconfig
(2.4 KB)
📄
sangfor_vmconfig_common
(27.99 KB)
📄
sangfor_vmconfig_ipc_callback
(4.75 KB)
📄
sangfor_watchdog
(3.95 KB)
📄
sfping.c
(15.68 KB)
📄
sfping.pl
(6.15 KB)
📄
startall
(1.78 KB)
📄
stopall
(1.11 KB)
📄
suse_vmconfig.sh
(6.19 KB)
📁
tools_x64
📁
tools_x86
📄
uni_test.sh
(2.59 KB)
📄
update_common_func
(4.35 KB)
📄
update_common_header
(4.86 KB)
📄
update_config
(2.89 KB)
📄
update_install
(28.84 KB)
📄
virtio_nic_attr_set.sh
(2.42 KB)
📄
virtio_nic_compat.sh
(5.28 KB)
📄
vm_ip_recover.sh
(16.66 KB)
📄
vm_ipc.sh
(9.06 KB)
📄
vmconfig_common_func
(10.76 KB)
📄
vmconfig_common_header
(3.37 KB)
📄
vmconfig_config
(805 B)
📄
vmtools-install.sh
(31.16 KB)
📄
watch_test.sh
(313 B)
📄
watchdog.sh
(1.39 KB)
📁
x64
📁
x86
Editing: update_common_func
#!/bin/bash shell_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) # . "${shell_dir}/log.sh" # This is not contain log.sh file because of it do not want conflict with other file # You should contain log.sh in you shell file if you want to use log. #Error log log_error(){ log "Error:$1" return } #Information log log_info(){ log "Info:$1" #test -f "${shell_dir}/debug" && log "Info:$1" return } #Warn log log_warn(){ log "Warn:$1" #test -f "${shell_dir}/debug" && log "Warn:$1" return } #Debug log log_debug(){ # log "Debug:$1" #Print when debug test -f "${shell_dir}/debug" && log "Debug:$1" return } #show error to screen show_error(){ echo "error:$1" > /dev/stdout return } #Create directory #$1 The path of directory. #return 0 success 1 failed #Return 0 if the directory exist. #Return 1 if the file is exist but it is not a directory. #This function will create the intermediate directory. create_dir(){ local dir="$1" local exit_code=0 if [ x"${dir}" = x"" ];then log_error "args is NULL!" return 1 fi if [ -e "${dir}" ];then #exist if [ -d "${dir}" ];then log_debug "dir:${dir} is already exist!" log_debug "create dir:${dir} success!" return 0 fi log_error "dir:${dir} is exist but it is not a dir!" return 1 fi #not exist mkdir -p "${dir}" 2>/dev/null exit_code=$? if [ ${exit_code} -ne 0 ];then log_error "create dir:${dir} failed! exit_code:${exit_code}" fi return ${exit_code} } #TEST create_dir TEST_create_dir(){ create_dir "/home/no-exist" echo "\n\n\n\n" create_dir "/home/no-exist" echo "\n\n\n\n" create_dir "/home/no-dir/no-exist" echo "\n\n\n\n" create_dir "/no-dir/no-exist" echo "\n\n\n\n" create_dir "/no-dir" echo "\n\n\n\n" create_dir "+++++++" echo "\n\n\n\n" } #Create directory (old version) #$1 The path of directory. #return 0 success 1 failed #Return 0 if the directory exist. #Return 1 if the file is exist but it is not a directory. #This function will create the intermediate directory. create_dir_old(){ local dir="$1" local parent="" local exit_code=1 if [ x"${dir}" = x"" ];then log_error "args is NULL!" return 1 fi if [ -e "${dir}" ];then #exist if [ -d "${dir}" ];then log_debug "dir:${dir} is already exist!" log_debug "create dir:${dir} success!" return 0 fi log_error "dir:${dir} is exist but it is not a dir!" return 1 fi #not exist and create parent="${dir%/*}" if [ x"${parent}" = x"${dir}" -o x"${parent}" = x"" ];then #The directory to create is the same with self. mkdir "${dir}" 2>/dev/null exit_code=$? if [ ${exit_code} -ne 0 ];then log_error "create dir:${dir} failed!" return 1 fi log_debug "create dir:${dir} success!" return 0 fi log_debug "parent dir:${dir}" create_dir "${parent}" exit_code=$? if [ ${exit_code} -ne 0 ];then log_error "create parent dir:${parent} failed!" return 1 fi mkdir "${dir}" 2>/dev/null exit_code=$? if [ ${exit_code} -ne 0 ];then log_error "create dir:${dir} failed!" return 1 fi log_debug "create dir:${dir} success!" return 0 } #TEST create_dir_old TEST_create_dir_old(){ create_dir "/home/no-exist" echo "\n\n\n\n" create_dir "/home/no-exist" echo "\n\n\n\n" create_dir "/home/no-dir/no-exist" echo "\n\n\n\n" create_dir "/no-dir/no-exist" echo "\n\n\n\n" create_dir "/no-dir" echo "\n\n\n\n" create_dir "+++++++" echo "\n\n\n\n" } # kill a process # $1 The name of process name. kill_process() { if [ $# -ne 1 ]; then log_error "parameter error!" return 1 fi if [ "$1" = "" ];then log_error "parameter is NULL" return 1 fi local pid=$$ local procname=${1} # Here is pipe, so can't execution with awk because it will cause out of order. local ps_list=`ps ax | grep "${procname}\>" | grep -v grep | grep -v sudo | grep -v "\<${pid}\>"` if [ ! -z "${ps_list}" ]; then echo "${ps_list}" | awk '{print "kill " $1 " 2>/dev/null"}' | sh fi return $? } TEST_kill_process(){ return 0 }
Upload File
Create Folder