X7ROOT File Manager
Current Path:
/usr/local/VMOptimizationTools_2.69.0
usr
/
local
/
VMOptimizationTools_2.69.0
/
๐
..
๐
LinuxUpdate.XML
(647 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
(16.62 KB)
๐
debian_vmconfig.sh
(13.48 KB)
๐
driver
๐
guest_system_config.sh
(1.82 KB)
๐
hostname_config
(1 B)
๐
ipv6_network_config
(94 B)
๐
log.sh
(1.36 KB)
๐
mod_test.sh
(3.69 KB)
๐
mod_test1.sh
(914 B)
๐
net_common.sh
(915 B)
๐
network_compat_flag
(0 B)
๐
network_config
(86 B)
๐
pwd_info_config
(1 B)
๐
redhat_vmconfig.sh
(17.93 KB)
๐
reset_duid_config
(21 B)
๐
sangfor_guest_datareport
(25.63 KB)
๐
sangfor_heartalive.sh
(2.37 KB)
๐
sangfor_module_update
(28.11 KB)
๐
sangfor_set_network.sh
(504 B)
๐
sangfor_sfping
(4.23 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
(3.55 KB)
๐
sangfor_vmconfig_common
(38.34 KB)
๐
sangfor_vmconfig_ipc_callback
(4.75 KB)
๐
sangfor_watchdog
(3.95 KB)
๐
sfping
(17.7 KB)
๐
sfping.pl
(8.57 KB)
๐
startall
(1.78 KB)
๐
stopall
(1.11 KB)
๐
suse_vmconfig.sh
(10.07 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
(33.63 KB)
๐
update_network.flag
(1 B)
๐
virtio_nic_attr_set.sh
(2.42 KB)
๐
virtio_nic_compat.sh.old1610337499
(5.64 KB)
๐
vm_ip_recover.sh
(16.66 KB)
๐
vm_ipc.sh
(9.06 KB)
๐
vmconfig_common_func
(23.11 KB)
๐
vmconfig_common_header
(3.37 KB)
๐
vmconfig_config
(1.02 KB)
๐
vmtools-install.sh
(31.16 KB)
๐
watch_test.sh
(313 B)
๐
watchdog.sh
(1.39 KB)
๐
x64
๐
x86
Editing: sangfor_sfping
#!/bin/bash shell_dir=`dirname "${BASH_SOURCE[0]}"` proc_name=`basename "${BASH_SOURCE[0]}"` #report_log_file=`basename "${BASH_SOURCE[0]}"` . "${shell_dir}/vm_ipc.sh" . "${shell_dir}/watchdog.sh" declare SEND_INTERVAL=1 #the interval of send packet #ๆถๆฏ็ฑปๅ declare -r MSGID_PING_SEND_LINUX=20001 #ๅ้icmpๅ declare -r MSGID_PING_SEND_RES_LINUX=20002 #่ฟๅ็ปๆไฟกๆฏ declare -r VMODID_PING=7 declare -r INST_ID=0 declare -r ENV_FAILED=245 #้่ฏฏๅท่กจ็คบๆฒกๆๅฎ่ฃ Socket6ๆ่ ้่ฆๅฎ่ฃ ๆฐ็ๆฌperl declare -r VERSION_ERR=235 LOG_NAME="/var/log/sfping.log" sf_debug() { echo "[D] $*" | tee -a $LOG_NAME; } sf_lerror() { echo "[E] $*" | tee -a $LOG_NAME; } # kill proccess # if the name of proccess is the same with the name of script,it won't kill itself # param $1: name of proccess(don't include path) # return if success then return 0 or return 1 kill_process() { if [ $# -ne 1 ]; then sf_lerror "parameter error!" return 1 fi local pid=$$ local procname=${1} #this is pipe,should't execute with awk,because the Shuffle local ps_list=`ps ax | grep "${procname}\>" | grep -v grep | grep -v "\<${pid}\>"` if [ ! -z "${ps_list}" ]; then echo "${ps_list}" | awk '{print "kill " $1 " 2>/dev/null"}' | sh fi return $? } ping_icmp_send_callback() { if [ $# -lt 3 ]; then sf_lerror "parameter error!" return 1 fi MSGBUF=`cat $3` #msg is save in file that $3 specified if [ ${MSGBUF} = "" ];then sf_lerror "recv empty msg" return 1 fi sf_debug "msgbuf = $MSGBUF" #msg format: "ctrl_cmd":"shutdown","vmid":"6476227890258" VERSION=`echo ${MSGBUF} | tr ',' '\n' | grep "version" | cut -d: -f 2 | sed s/[\"{}]//g` VMID=`echo ${MSGBUF} | tr ',' '\n' | grep "vmid" | cut -d: -f 2 | sed s/[\"{}]//g` HOSTID=`echo ${MSGBUF} | tr ',' '\n' | grep "hostid" | cut -d: -f 2 | sed s/[\"{}]//g` PKT_ID=`echo ${MSGBUF} | tr ',' '\n' | grep "pkt_id" | cut -d: -f 2 | sed s/[\"{}]//g` IFID=`echo ${MSGBUF} | tr ',' '\n' | grep "ifid" | cut -d: -f 2 | sed s/[\"{}]//g` # to support ipv6 address, need cut string from the second : to the end DSTIP=`echo ${MSGBUF} | tr ',' '\n' | grep "dstip" | cut -d: -f 2- | sed s/[\"{}]//g` if [ x"$VERSION" = x"" -o x"$VMID" = x"" -o x"$HOSTID" = x"" -o x"$PKT_ID" = x"" -o x"$IFID" = x"" -o -z "$DSTIP" ]; then sf_lerror "VERSION = $VERSION,VMID = $VMID,HOSTID = $HOSTID,PKT_ID = $PKT_ID,IFID = $IFID,DSTIP = $DSTIP has illegal param!" return 1 fi sf_debug "VERSION = $VERSION,VMID = $VMID,HOSTID = $HOSTID,PKT_ID = $PKT_ID,IFID = $IFID,DSTIP = $DSTIP" #test ping ไธไธ ping -c 1 -i 1 "$DSTIP" if [ -e "${shell_dir}/sfping" ]; then sf_debug "begin to ${shell_dir}/sfping" ${shell_dir}/sfping "$VERSION" "$VMID" "$HOSTID" "$PKT_ID" "$IFID" "$DSTIP" ret=$? else perl_path=`which perl` if [ -z "$perl_path" ]; then ret=${ENV_FAILED}; else echo "$perl_path" | grep "no perl" ret=$? if [ $ret -ne 0 ];then perl -c ${shell_dir}/sfping.pl 2>/dev/null check_ret=$? if [ $check_ret -ne 0 ]; then sf_lerror "${shell_dir}/sfping.pl check failed! ret = $check_ret" ret=${VERSION_ERR} else sf_debug "begin to ${shell_dir}/sfping.pl" ${shell_dir}/sfping.pl "$VERSION" "$VMID" "$HOSTID" "$PKT_ID" "$IFID" "$DSTIP" ret=$? if [ $ret -ne 0 ]; then sf_lerror "${shell_dir}/sfping.pl failed! ret = $ret" fi fi else ret=${ENV_FAILED} fi fi fi MSG_INFO_DATA="{\"version\":${VERSION},\"pkt_id\":${PKT_ID},\"hostid\":\"${HOSTID}\",\"vmid\":\"${VMID}\",\"ifid\":${IFID},\"res\":${ret}}" sf_debug "to local host = $MSG_INFO_DATA" vm_ipc_to_local_host ${VMODID_PING} ${INST_ID} ${MSGID_PING_SEND_RES_LINUX} "${MSG_INFO_DATA}" || return 1; return 0; } main() { #initialize the environment kill_process "${proc_name}" #join the monitor watchdog_reg_proccess "${proc_name}" #initialize vm_ipc_init ${VMODID_PING} ${INST_ID} if [ $? -ne 0 ]; then log "vm_ipc_init() failed! modid='${modid}' instid='${instid}'" return 1 fi sf_debug "vm_ipc_init success." #Registration message callback function vm_ipc_reg_callback ${MSGID_PING_SEND_LINUX} ping_icmp_send_callback sf_debug "start while send_data_to_host" while true do vm_ipc_event_loop_once watchdog_check_once sleep ${SEND_INTERVAL} done } main
Upload File
Create Folder