#!/bin/bash echo "{" files=$1 LINK_PATH=/export/auto_deploy/links echo " \"appList\":[" for f in `ls $files`; do link_file=$LINK_PATH/$f if [ -h "$link_file" ]; then REAL_PATH=`readlink $link_file` #echo "real path $REAL_PATH" package_link=$REAL_PATH/package_runtime if [ -h "$package_link" ];then package=`readlink $package_link` cur_version=`echo $package | awk -F"package/" '{print $2}'` echo " {\"path\":\"$files/$f\", \"runtimeVersion\":\"$cur_version\"}," fi else echo " {\"path\":\"$files/$f\",\"runtimeVersion\":\"\"}," fi done echo " ]," ips=`/sbin/ifconfig | grep -i "inet" | grep -iv "inet6"| grep -v '127.0.0.1' | awk {'print $2'} | sed -ne 's/addr\://p'` ip_list="127.0.0.1" for ip in $ips; do ip_list="$ip_list","$ip" done echo " \"hostIp\":\"$ip_list\"," host_name=`hostname` echo " \"hostName\":\"$host_name\"," os_version=`cat /etc/issue | head -n 1` echo " \"osVersion\":\"$os_version\"" echo "}"